github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/staticcheck/testdata/src/CheckSelfAssignment/CheckSelfAssignment.go (about) 1 package pkg 2 3 func fn(x int) { 4 var z int 5 var y int 6 x = x // MATCH "self-assignment" 7 y = y // MATCH "self-assignment" 8 y, x, z = y, x, 1 9 y = x 10 _ = y 11 _ = x 12 _ = z 13 func() { 14 x := x 15 println(x) 16 }() 17 } 18 19 // MATCH:8 "self-assignment of y to y" 20 // MATCH:8 "self-assignment of x to x"