.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
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/staticcheck/testdata/src/CheckTypedNilInterface/i27815/27815.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.1.1/staticcheck/testdata/src/CheckTypedNilInterface/i27815/27815.go
new file mode 100644 (file)
index 0000000..8418d1f
--- /dev/null
@@ -0,0 +1,28 @@
+package main
+
+import (
+       "fmt"
+)
+
+type MyError struct {
+       x string
+}
+
+func (e *MyError) Error() string {
+       return e.x
+}
+
+func f() *MyError {
+       return nil
+}
+
+func main() {
+       var e error
+       e = f()
+       // e should be nil ?
+       if e != nil { // want `this comparison is always true`
+               fmt.Println("NOT NIL")
+       } else {
+               fmt.Println("NIL")
+       }
+}