Skip to content

Commit

Permalink
fix goerr13 dependencies (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
jirfag committed May 13, 2020
1 parent 1ccecec commit 6b124f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/lint/lintersdb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
11 changes: 11 additions & 0 deletions test/testdata/goerr113.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
//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"`
}

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
}

0 comments on commit 6b124f1

Please sign in to comment.