Skip to content

Commit 6b124f1

Browse files
authored
fix goerr13 dependencies (#1089)
1 parent 1ccecec commit 6b124f1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/lint/lintersdb/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
255255
WithURL("https://github.com/tommy-muehle/go-mnd"),
256256
linter.NewConfig(golinters.NewGoerr113()).
257257
WithPresets(linter.PresetStyle).
258+
WithLoadForGoAnalysis().
258259
WithURL("https://github.com/Djarvur/go-err113"),
259260
linter.NewConfig(golinters.NewGomodguard()).
260261
WithPresets(linter.PresetStyle).

test/testdata/goerr113.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
//args: -Egoerr113
22
package testdata
33

4+
import "os"
5+
46
func SimpleEqual(e1, e2 error) bool {
57
return e1 == e2 // ERROR `err113: do not compare errors directly, use errors.Is() instead: "e1 == e2"`
68
}
79

810
func SimpleNotEqual(e1, e2 error) bool {
911
return e1 != e2 // ERROR `err113: do not compare errors directly, use errors.Is() instead: "e1 != e2"`
1012
}
13+
14+
func CheckGoerr13Import(e error) bool {
15+
f, err := os.Create("f.txt")
16+
if err != nil {
17+
return err == e // ERROR `err113: do not compare errors directly, use errors.Is() instead: "err == e"`
18+
}
19+
f.Close()
20+
return false
21+
}

0 commit comments

Comments
 (0)