1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-25 22:12:38 +02:00

unhandled-error (new rule) (#124)

* unhandled-error (new rule)

* better failure msg

* encapsulates error type detection
This commit is contained in:
SalvadorC
2019-04-28 04:23:17 +02:00
committed by Minko Gechev
parent e8c1baf8ac
commit 8aa0cd8bd4
6 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package fixtures
import (
"fmt"
"os"
)
func unhandledError1(a int) (int, error) {
return a, nil
}
func unhandledError2() error {
_, err := unhandledError1(1)
unhandledError1(1) // MATCH /Unhandled error in call to function unhandledError1/
fmt.Fprintf(nil, "") // MATCH /Unhandled error in call to function fmt.Fprintf/
os.Chdir("..") // MATCH /Unhandled error in call to function os.Chdir/
_ = os.Chdir("..")
return err
}