-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Description
What version of Go are you using (go version)?
$ go version go1.17.1
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="on" GOARCH="amd64" GOBIN="/home/user/bin" GOCACHE="/home/user/.cache/go-build" GOENV="/home/user/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/user/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/user" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/user/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/user/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.1" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" 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-build3606891520=/tmp/go-build -gno-record-gcc-switches"
What did you do?
What did you expect to see?
Reflect safely construct a struct equivalent to the struct created by the compiler.
What did you see instead?
panic: reflect.StructOf: duplicate field _
Additional information
I am using this to pad structs to match C structs dynamically, so I can work around this by providing the padding fields with an iota suffix, but it would be nice if this just worked. Looking at reflect.StructOf, making the duplication check here conditional on the Name not being "_" fixes the issue.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.