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()
}()
}
You can get unrecover
by go install
command (Go 1.16 and higher).
$ go install github.com/gostaticanalysis/unrecover/cmd/unrecover@latest
unrecover
run with go vet
as below when Go is 1.12 and higher.
$ go vet -vettool=$(which unrecover) ./...
You can use unrecover.Analyzer with unitchecker.