github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/golinters/nilerr.go (about) 1 package golinters 2 3 import ( 4 "github.com/gostaticanalysis/nilerr" 5 "golang.org/x/tools/go/analysis" 6 7 "github.com/elek/golangci-lint/pkg/golinters/goanalysis" 8 ) 9 10 func NewNilErr() *goanalysis.Linter { 11 a := nilerr.Analyzer 12 return goanalysis.NewLinter( 13 a.Name, 14 "Finds the code that returns nil even if it checks that the error is not nil.", 15 []*analysis.Analyzer{a}, 16 nil, 17 ).WithLoadMode(goanalysis.LoadModeTypesInfo) 18 }