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:
19
fixtures/unhandled-error.go
Normal file
19
fixtures/unhandled-error.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user