Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.04 KB

README.md

File metadata and controls

44 lines (30 loc) · 1.04 KB

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.