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

     1  //golangcitest:args -Eerrcheck
     2  //golangcitest:config_path testdata/configs/errcheck_ignore_default.yml
     3  package testdata
     4  
     5  import (
     6  	"crypto/sha256"
     7  	"fmt"
     8  	"os"
     9  )
    10  
    11  func TestErrcheckIgnoreHashWriteByDefault() []byte {
    12  	h := sha256.New()
    13  	h.Write([]byte("food"))
    14  	return h.Sum(nil)
    15  }
    16  
    17  func TestErrcheckIgnoreFmtByDefault(s string) int {
    18  	n, _ := fmt.Println(s)
    19  	return n
    20  }
    21  
    22  func TestErrcheckNoIgnoreOs() {
    23  	_, _ = os.Open("f.txt") // want "Error return value of `os.Open` is not checked"
    24  }