No description
  • Go 97.3%
  • Makefile 2.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Fernandez Ludovic 015671e622 chore: cleaning
2025-09-18 02:01:02 +02:00
.github/workflows chore: add CI 2025-09-18 02:01:02 +02:00
cmd/nilerr chore: change module name 2025-09-18 02:01:02 +02:00
testdata/src/a fix: stackoverflow 2025-09-18 02:01:02 +02:00
.gitignore chore: add gitignore 2025-09-18 02:01:02 +02:00
go.mod chore: change module name 2025-09-18 02:01:02 +02:00
go.sum chore: update x/tools 2025-09-18 02:01:02 +02:00
LICENSE Initial commit 2019-03-08 17:22:49 +09:00
Makefile chore: add Makefile 2025-09-18 02:01:02 +02:00
nilerr.go chore: cleaning 2025-09-18 02:01:02 +02:00
nilerr_test.go chore: change module name 2025-09-18 02:01:02 +02:00
README.md Update README.md 2021-12-10 14:10:39 +09:00

nilerr

pkg.go.dev

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 ./...