diff --git a/test/run_test.go b/test/run_test.go index 3904cec9..cbc8bdb3 100644 --- a/test/run_test.go +++ b/test/run_test.go @@ -59,8 +59,10 @@ func TestCgoOk(t *testing.T) { } func TestCgoWithIssues(t *testing.T) { - testshared.NewLintRunner(t).Run("--no-config", "--enable-all", getTestDataDir("cgo_with_issues")). + testshared.NewLintRunner(t).Run("--no-config", "--disable-all", "-Egovet", getTestDataDir("cgo_with_issues")). ExpectHasIssue("Printf format %t has arg cs of wrong type") + testshared.NewLintRunner(t).Run("--no-config", "--disable-all", "-Estaticcheck", getTestDataDir("cgo_with_issues")). + ExpectHasIssue("SA5009: Printf format %t has arg #1 of wrong type") } func TestUnsafeOk(t *testing.T) { diff --git a/test/testdata/govet.go b/test/testdata/govet.go index ed9d9bed..c928699c 100644 --- a/test/testdata/govet.go +++ b/test/testdata/govet.go @@ -3,6 +3,7 @@ package testdata import ( + "fmt" "io" "os" ) @@ -30,3 +31,8 @@ func GovetNolintVet() error { func GovetNolintVetShadow() error { return &os.PathError{"first", "path", os.ErrNotExist} //nolint:vetshadow } + +func GovetPrintf() { + x := "dummy" + fmt.Printf("%d", x) // ERROR "printf: Printf format %d has arg x of wrong type string" +} diff --git a/test/testdata/staticcheck.go b/test/testdata/staticcheck.go index 6297b8a2..f6b78b57 100644 --- a/test/testdata/staticcheck.go +++ b/test/testdata/staticcheck.go @@ -2,6 +2,7 @@ package testdata import ( + "fmt" "runtime" ) @@ -23,3 +24,8 @@ func StaticcheckNolintMegacheck() { 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" +}