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

     1  //golangcitest:args -Estaticcheck
     2  package testdata
     3  
     4  import (
     5  	"fmt"
     6  )
     7  
     8  func Staticcheck() {
     9  	var x int
    10  	x = x // want "self-assignment of x to x"
    11  	fmt.Printf("%d", x)
    12  }
    13  
    14  func StaticcheckNolintStaticcheck() {
    15  	var x int
    16  	x = x //nolint:staticcheck
    17  }
    18  
    19  func StaticcheckNolintMegacheck() {
    20  	var x int
    21  	x = x //nolint:megacheck
    22  }
    23  
    24  func StaticcheckPrintf() {
    25  	x := "dummy"
    26  	fmt.Printf("%d", x) // want "SA5009: Printf format %d has arg #1 of wrong type"
    27  }