You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/mvNenqW5RdZ
What did you expect to see?
Reflect safely construct a struct equivalent to the struct created by the compiler.
What did you see instead?
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 theName
not being "_" fixes the issue.The text was updated successfully, but these errors were encountered: