Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check err != nil is true on nil error #15591

Closed
rot256 opened this issue May 7, 2016 · 1 comment
Closed

Check err != nil is true on nil error #15591

rot256 opened this issue May 7, 2016 · 1 comment

Comments

@rot256
Copy link

rot256 commented May 7, 2016

Go version

go version go1.6.1 linux/amd6

Environment

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rot256/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

The distro is Debian (unstable)

Reproducing

See this program for a POC

Notes

I expected the last line to not be printed,
since "Junk" returns nil (and the program typechecks)
I expected err != nil to be false.

I don't know if this is intended behavior, but it seems error prone.

@ALTree
Copy link
Member

ALTree commented May 7, 2016

See Why is my nil error value not equal to nil?

@bradfitz bradfitz closed this as completed May 7, 2016
@golang golang locked and limited conversation to collaborators May 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants