github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/errcheck_ignore.go (about)

     1  //golangcitest:args -Eerrcheck
     2  //golangcitest:config_path testdata/configs/ignore_config.yml
     3  package testdata
     4  
     5  import (
     6  	"fmt"
     7  	"io/ioutil"
     8  	"os"
     9  )
    10  
    11  func TestErrcheckIgnoreOs() {
    12  	_, _ = os.Open("f.txt")
    13  }
    14  
    15  func TestErrcheckIgnoreFmt(s string) int {
    16  	n, _ := fmt.Println(s)
    17  	return n
    18  }
    19  
    20  func TestErrcheckIgnoreIoutil() []byte {
    21  	ret, _ := ioutil.ReadFile("f.txt")
    22  	return ret
    23  }
    24  
    25  func TestErrcheckNoIgnoreIoutil() []byte {
    26  	ret, _ := ioutil.ReadAll(nil) // want "Error return value of `ioutil.ReadAll` is not checked"
    27  	return ret
    28  }