fix goerr13 dependencies (#1089)

This commit is contained in:
Isaev Denis 2020-05-13 21:22:52 +03:00 committed by GitHub
parent 1ccecec4d1
commit 6b124f1a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -255,6 +255,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithURL("https://github.com/tommy-muehle/go-mnd"), WithURL("https://github.com/tommy-muehle/go-mnd"),
linter.NewConfig(golinters.NewGoerr113()). linter.NewConfig(golinters.NewGoerr113()).
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithLoadForGoAnalysis().
WithURL("https://github.com/Djarvur/go-err113"), WithURL("https://github.com/Djarvur/go-err113"),
linter.NewConfig(golinters.NewGomodguard()). linter.NewConfig(golinters.NewGomodguard()).
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).

View File

@ -1,6 +1,8 @@
//args: -Egoerr113 //args: -Egoerr113
package testdata package testdata
import "os"
func SimpleEqual(e1, e2 error) bool { func SimpleEqual(e1, e2 error) bool {
return e1 == e2 // ERROR `err113: do not compare errors directly, use errors.Is() instead: "e1 == e2"` 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 { func SimpleNotEqual(e1, e2 error) bool {
return e1 != e2 // ERROR `err113: do not compare errors directly, use errors.Is() instead: "e1 != e2"` 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
}