staticcheck/sa4022/testdata/go1.0/CheckAddressIsNil/CheckAddressIsNil.go
raw| 1 | package pkg |
| 2 | |
| 3 | func fn(x int, y *int) { |
| 4 | _ = &x == nil //@ diag(`the address of a variable cannot be nil`) |
| 5 | _ = &y != nil //@ diag(`the address of a variable cannot be nil`) |
| 6 | |
| 7 | if &x != nil { //@ diag(`the address of a variable cannot be nil`) |
| 8 | println("obviously.") |
| 9 | } |
| 10 | |
| 11 | if y == nil { |
| 12 | } |
| 13 | } |