.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / staticcheck / testdata / src / CheckTypedNilInterface / i33965 / 33965.go
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) // want `this comparison is never true`
26 }