fix goerr13 dependencies (#1089)
This commit is contained in:
parent
1ccecec4d1
commit
6b124f1a0e
@ -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).
|
||||
|
11
test/testdata/goerr113.go
vendored
11
test/testdata/goerr113.go
vendored
@ -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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user