diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 33b4378c7ab3..1ec78de287ac 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -255,6 +255,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithURL("https://github.com/tommy-muehle/go-mnd"), linter.NewConfig(golinters.NewGoerr113()). WithPresets(linter.PresetStyle). + WithLoadForGoAnalysis(). WithURL("https://github.com/Djarvur/go-err113"), linter.NewConfig(golinters.NewGomodguard()). WithPresets(linter.PresetStyle). diff --git a/test/testdata/goerr113.go b/test/testdata/goerr113.go index 3154e7cfa9d9..3f2a4e2933cb 100644 --- a/test/testdata/goerr113.go +++ b/test/testdata/goerr113.go @@ -1,6 +1,8 @@ //args: -Egoerr113 package testdata +import "os" + func SimpleEqual(e1, e2 error) bool { return e1 == e2 // ERROR `err113: do not compare errors directly, use errors.Is() instead: "e1 == e2"` } @@ -8,3 +10,12 @@ func SimpleEqual(e1, e2 error) bool { func SimpleNotEqual(e1, e2 error) bool { return e1 != e2 // ERROR `err113: do not compare errors directly, use errors.Is() instead: "e1 != e2"` } + +func CheckGoerr13Import(e error) bool { + f, err := os.Create("f.txt") + if err != nil { + return err == e // ERROR `err113: do not compare errors directly, use errors.Is() instead: "err == e"` + } + f.Close() + return false +} \ No newline at end of file