2022-07-15 15:32:10 +02:00
|
|
|
//golangcitest:args -Eerrcheck
|
2022-08-15 18:23:07 +02:00
|
|
|
//golangcitest:config_path testdata/configs/errcheck_ignore_default.yml
|
2018-12-23 11:36:21 +03:00
|
|
|
package testdata
|
|
|
|
|
|
|
|
import (
|
2021-02-25 06:16:48 -06:00
|
|
|
"crypto/sha256"
|
2018-12-23 11:36:21 +03:00
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2021-02-25 06:16:48 -06:00
|
|
|
func TestErrcheckIgnoreHashWriteByDefault() []byte {
|
|
|
|
h := sha256.New()
|
|
|
|
h.Write([]byte("food"))
|
|
|
|
return h.Sum(nil)
|
|
|
|
}
|
|
|
|
|
2018-12-23 11:36:21 +03:00
|
|
|
func TestErrcheckIgnoreFmtByDefault(s string) int {
|
|
|
|
n, _ := fmt.Println(s)
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestErrcheckNoIgnoreOs() {
|
2022-08-20 18:53:45 +02:00
|
|
|
_, _ = os.Open("f.txt") // want "Error return value of `os.Open` is not checked"
|
2018-12-23 11:36:21 +03:00
|
|
|
}
|