-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
We use the nilerr as part of golangci-lint. It uses a newer version of golang.org/x/tools library, producing false negative results. The problem appears starting from golang.org/x/tools v0.22.0. Now, you use an outdated version of the library:
Line 7 in e68fdc0
| golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6 |
Here is the minimal test that passes with golang.org/x/tools v0.21.0 and fails with golang.org/x/tools v0.22.0 (or greater):
package a
func issue() error {
defer func() {}()
err := do()
if err != nil {
return nil // want "error is not nil \\(line 6\\) but it returns nil"
}
return nil
}$ go get golang.org/x/tools@v0.21.0
go: upgraded golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6 => v0.21.0
$ go mod tidy
$ go test
PASS
ok github.com/gostaticanalysis/nilerr 0.391s
$ go get golang.org/x/tools@v0.22.0
go: upgraded golang.org/x/tools v0.21.0 => v0.22.0
$ go mod tidy
$ go test
--- FAIL: Test (0.57s)
analysistest.go:604: a/a.go:192: no diagnostic was reported matching `error is not nil \(lines \[178 181\]\) but it returns nil`
analysistest.go:604: a/b.go:8: no diagnostic was reported matching `error is not nil \(line 6\) but it returns nil`
FAIL
exit status 1
FAIL github.com/gostaticanalysis/nilerr 0.778s
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels