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

net: IP.Equals returns true when comparing nil values #60123

Closed
jeffy-mathew opened this issue May 11, 2023 · 1 comment
Closed

net: IP.Equals returns true when comparing nil values #60123

jeffy-mathew opened this issue May 11, 2023 · 1 comment

Comments

@jeffy-mathew
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.20.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jeff/Library/Caches/go-build"
GOENV="/Users/jeff/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/jeff/.gvm/pkgsets/go1.20.4/global/pkg/mod"
GONOPROXY="github.com/TykTechnologies"
GONOSUMDB="github.com/TykTechnologies"
GOOS="darwin"
GOPATH="/Users/jeff/.gvm/pkgsets/go1.20.4/global"
GOPRIVATE="github.com/TykTechnologies"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/jeff/.gvm/gos/go1.20.4"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/jeff/.gvm/gos/go1.20.4/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hr/85yzfms503jcqnbtq95rjpkw0000gn/T/go-build1709030999=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I'm trying to compare two net.IPs which are nil.
https://go.dev/play/p/fmHC7Q9KMBY

What did you expect to see?

The comparison IP.Equals should return false

What did you see instead?

IP.Equals returns true when both values are nil

@robpike
Copy link
Contributor

robpike commented May 11, 2023

But nil is equal to nil. I'm not sure why you think otherwise.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants