go: internal/reflectlite: Implements erroneously reports that map types do not implement interfaces
What version of Go are you using (go version
)?
$ go version go version go1.13 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/james/Library/Caches/go-build" GOENV="/Users/james/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/james/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.13/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.13/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/james/src/proglottis/ts/go.mod" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nn/cm9pxx2x4pzcmc4_brdzc_9m0000gn/T/go-build569203332=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Tried to check if an error was of type schema.MultiError.
https://play.golang.org/p/eAMul1kgxXJ
What did you expect to see?
Preferably it would populate my errMulti := schema.MultiError{}
variable so I can inspect the contents for better error handling.
What did you see instead?
A runtime error:
runtime: nameOff 0x74696177 out of range 0xf0000 - 0x161ba6
fatal error: runtime: name offset out of range
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (16 by maintainers)
Commits related to this issue
- runtime: add doc to remind adopting changes to reflectlite Updates #34486 Change-Id: Iec9a5d120013aaa287eccf2999b3f2b831be070e Reviewed-on: https://go-review.googlesource.com/c/go/+/197558 Reviewed-... — committed to golang/go by cuonglm 5 years ago
- internal/reflectlite: add type mirror with reflect test Add test to check that struct type in reflectlite is mirror of reflect. Note that the test does not check the field types, only check for numbe... — committed to golang/go by cuonglm 5 years ago
One thing that I noticed while looking at reflectlite is that we forgot to update it (we updated reflect) in https://golang.org/cl//191198 which likely causes mismatches of struct definitions between runtime and reflectlite.
Especially the map type is now larger: https://github.com/golang/go/blob/0f7b4e72a054f974489d8342cdae5a6a7ba7a31b/src/internal/reflectlite/type.go#L245 https://github.com/golang/go/blob/9c0e56bf9de5ff8faa73860ab6bb43562722c18f/src/runtime/type.go#L363
While at it we should add tests (to avoid misalignment and breakage of reflectlite) and update the comments to reference reflectlite for updates too.
Im happy work on a fix tomorrow evening UTC if no one jumps on realigning the definitions earlier.