golangci-lint/test/testdata/staticcheck.go
Trevor Pounds a653032409 Fix flaky cgo test failures. (#716)
Fixes flaky cgo test failures caused by duplicate printf
format checks in staticcheck and go vet that use slightly
different reporting formats.
2019-09-20 19:05:01 +03:00

32 lines
542 B
Go

//args: -Estaticcheck
package testdata
import (
"fmt"
"runtime"
)
func Staticcheck() {
var x int
x = x // ERROR "self-assignment of x to x"
}
func StaticcheckNolintStaticcheck() {
var x int
x = x //nolint:staticcheck
}
func StaticcheckNolintMegacheck() {
var x int
x = x //nolint:megacheck
}
func StaticcheckDeprecated() {
_ = runtime.CPUProfile() // ERROR "SA1019: runtime.CPUProfile is deprecated"
}
func StaticcheckPrintf() {
x := "dummy"
fmt.Printf("%d", x) // ERROR "SA5009: Printf format %d has arg #1 of wrong type"
}