-
Notifications
You must be signed in to change notification settings - Fork 18k
reflect: Type.Comparable returns incorrect values for some types obtained via reflection #21011
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
Comments
Nice. But because this is not a regression, there's no time (or risk) budget for Go 1.9, due out shortly. |
I think this is correct behavior. If you print In other words, this is approximately equivalent to
which will also panic. |
Whoops, I overlooked the type interface {} after "var i". I agree this looks fine. |
That's fine, but if interface{} is comparable, why can't I use it in the map then? |
Also everything works as expected if I remove pointer: |
You can use an What you can't do is use an If you remove the pointer, then the value you get in |
Thanks! I think I've misunderstood, what Interface() returns: // Special case: return the element inside the interface. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8.3 darwin/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.8/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rk/3wxxpsdj3kx052390hbwxk0h0000gn/T/go-build181924434=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/l7rmrLiGvY
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: