.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / staticcheck / testdata / src / CheckTypedNilInterface / i27815 / 27815.go
1 package main
2
3 import (
4         "fmt"
5 )
6
7 type MyError struct {
8         x string
9 }
10
11 func (e *MyError) Error() string {
12         return e.x
13 }
14
15 func f() *MyError {
16         return nil
17 }
18
19 func main() {
20         var e error
21         e = f()
22         // e should be nil ?
23         if e != nil { // want `this comparison is always true`
24                 fmt.Println("NOT NIL")
25         } else {
26                 fmt.Println("NIL")
27         }
28 }