unrecover

package module
v0.0.0-...-37f4e45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2021 License: MIT Imports: 14 Imported by: 0

README

unrecover

pkg.go.dev

unrecover finds a calling function in other goroutine which does not recover any panic.

func f() {
	go func() { // want "this goroutine does not recover a panic"
	}()

	go func() { // OK
		defer func() { recover() }()
	}()

	go func() { // want "this goroutine does not recover a panic"
		recover()
	}()
}

Install

You can get unrecover by go install command (Go 1.16 and higher).

$ go install github.com/gostaticanalysis/unrecover/cmd/unrecover@latest

How to use

unrecover run with go vet as below when Go is 1.12 and higher.

$ go vet -vettool=$(which unrecover) ./...

Analyze with golang.org/x/tools/go/analysis

You can use unrecover.Analyzer with unitchecker.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "unrecover",
	Doc:  doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
		buildssa.Analyzer,
		forcetypeassert.Analyzer,
	},
	FactTypes: []analysis.Fact{(*isPanicableFunc)(nil)},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL