staticcheck/sa4023/testdata/go1.0/i33965/33965.go
raw| 1 | package pkg |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | type customError struct { |
| 9 | } |
| 10 | |
| 11 | func (p *customError) Error() string { |
| 12 | return "custom error" |
| 13 | } |
| 14 | |
| 15 | func getNilCustomError() *customError { |
| 16 | return nil |
| 17 | } |
| 18 | |
| 19 | func TestWebSocketClient_basic(t *testing.T) { |
| 20 | err1 := getNilCustomError() |
| 21 | fmt.Println(err1 == nil) // ok is true |
| 22 | |
| 23 | err2 := error(nil) |
| 24 | err2 = getNilCustomError() |
| 25 | fmt.Println(err2 == nil) //@ diag(`this comparison is never true`) |
| 26 | } |