golangci-lint/test/testdata/errcheck_ignore.go
Sergey Vilgelm b77118fdac
Use errcheck from main repo instead of golangci-lint fork (#1319)
Co-authored-by: Roman Leventov <leventov@ya.ru>
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2021-02-25 13:16:48 +01:00

29 lines
509 B
Go

//args: -Eerrcheck
//config_path: testdata/errcheck/ignore_config.yml
package testdata
import (
"fmt"
"io/ioutil"
"os"
)
func TestErrcheckIgnoreOs() {
_, _ = os.Open("f.txt")
}
func TestErrcheckIgnoreFmt(s string) int {
n, _ := fmt.Println(s)
return n
}
func TestErrcheckIgnoreIoutil() []byte {
ret, _ := ioutil.ReadFile("f.txt")
return ret
}
func TestErrcheckNoIgnoreIoutil() []byte {
ret, _ := ioutil.ReadAll(nil) // ERROR "Error return value of `ioutil.ReadAll` is not checked"
return ret
}