-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Confmap does not honor Unmarshal
methods on embedded structs
#6671
Comments
I spent a bit working on this but I am not sure how to fix it. It looks related to mitchellh/mapstructure/issues/166, so maybe @jefchien has some ideas? |
This seems like a different issue. When mapstructure tries to decode a map into a struct, it has this loop that handles the squashing of the embedded struct fields https://github.com/mitchellh/mapstructure/blob/main/mapstructure.go#L1340. Since it happens in this step, it doesn't try to decode the embedded struct as a whole and only calls |
I checked this with @gbbr and we don't see a way to fix it short of re-implementing the |
In the current |
…ts. (#9635) **Description:** This implements support for calling `Unmarshal` on embedded structs of structs being decoded. **Link to tracking Issue:** Fixes #6671 **Testing:** Unit tests. Contrib fix is open: open-telemetry/opentelemetry-collector-contrib#31406
…ts. (open-telemetry#9635) **Description:** This implements support for calling `Unmarshal` on embedded structs of structs being decoded. **Link to tracking Issue:** Fixes open-telemetry#6671 **Testing:** Unit tests. Contrib fix is open: open-telemetry/opentelemetry-collector-contrib#31406
Describe the bug
The confmap
Unmarshal
method honors theUnmarshal
methods on field structs but does not do so on embedded structs.Steps to reproduce
See #6668 for an example
What version did you use?
Happens as of fb0842a
The text was updated successfully, but these errors were encountered: