2022-07-15 15:32:10 +02:00
|
|
|
//golangcitest:args -Estaticcheck
|
2019-01-08 14:31:04 +03:00
|
|
|
package testdata
|
|
|
|
|
2019-09-17 08:42:16 +03:00
|
|
|
import (
|
2019-09-20 12:05:01 -04:00
|
|
|
"fmt"
|
2019-09-17 08:42:16 +03:00
|
|
|
)
|
|
|
|
|
2019-01-08 14:31:04 +03:00
|
|
|
func Staticcheck() {
|
|
|
|
var x int
|
2022-08-20 18:53:45 +02:00
|
|
|
x = x // want "self-assignment of x to x"
|
2020-03-10 12:50:48 +01:00
|
|
|
fmt.Printf("%d", x)
|
2019-01-08 14:31:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func StaticcheckNolintStaticcheck() {
|
|
|
|
var x int
|
|
|
|
x = x //nolint:staticcheck
|
|
|
|
}
|
|
|
|
|
|
|
|
func StaticcheckNolintMegacheck() {
|
|
|
|
var x int
|
|
|
|
x = x //nolint:megacheck
|
|
|
|
}
|
2019-09-17 08:42:16 +03:00
|
|
|
|
2019-09-20 12:05:01 -04:00
|
|
|
func StaticcheckPrintf() {
|
|
|
|
x := "dummy"
|
2022-08-20 18:53:45 +02:00
|
|
|
fmt.Printf("%d", x) // want "SA5009: Printf format %d has arg #1 of wrong type"
|
2019-09-20 12:05:01 -04:00
|
|
|
}
|