mirror of
https://github.com/golangci/nilerr
synced 2026-07-22 16:53:47 +00:00
No description
- Go 97.3%
- Makefile 2.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| cmd/nilerr | ||
| testdata/src/a | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| nilerr.go | ||
| nilerr_test.go | ||
| README.md | ||
nilerr
nilerr finds code which returns nil even though it checks that error is not nil.
func f() error {
err := do()
if err != nil {
return nil // miss
}
}
nilerr also finds code which returns error even though it checks that error is nil.
func f() error {
err := do()
if err == nil {
return err // miss
}
}
nilerr ignores code which has a miss with ignore comment.
func f() error {
err := do()
if err != nil {
//lint:ignore nilerr reason
return nil // ignore
}
}
How to use
$ go install github.com/gostaticanalysis/nilerr/cmd/nilerr@latest
$ nilerr ./...