Closed as not planned
Description
What version of Go are you using (go version
)?
$ go version go version go1.12.9 linux/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 GOARCH="amd64" GOBIN="" GOCACHE="/home/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/goworkspace" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build909978713=/tmp/go-build -gno-record-gcc-switches"
What did you do?
https://play.golang.org/p/IOwj_PHRGXK
What did you expect to see?
I did not expect v
to be of type map[string]interface{}, as its underlying type is clearly Y.
What did you see instead?
v
is of type map[string]interface{}, failing the type assertion.
Note that if it's a pointer to Y, it works correctly.
Also, this came from a bigger project where Sprintf was reporting both v
and Y{}
with the same underlying type, however, I was unable to reproduce that here.
Also, removing json.Unmarshal fixes the issue, as the boxed Y is cast correctly to Y when there is no unmarshal.