Open ardrabczyk opened 9 months ago
👋 Thanks for reporting!
A maintainer will take a look at your issue shortly. 👀
In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.
⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9
📣 If you've already given us your feedback, you can still help by spreading the news, either by sharing the above link or telling people about this on Twitter:
https://twitter.com/sagikazarmark/status/1306904078967074816
Thank you! ❤️
I found I can always do
var md mapstructure.Metadata
err = viper.Unmarshal(&settings, func(config *mapstructure.DecoderConfig) {
config.Metadata = &md
})
and then loop through md.Unused
but UnmarshalExact()
doesn't set it, I don't yet know why.
EDIT:
decodeStructFromMap()
returns early when ErrorUnused is set https://github.com/mitchellh/mapstructure/blob/main/mapstructure.go#L1459
Preflight Checklist
Problem Description
Example:
Output:
Can this
* '' has invalid keys: extra
error get more readable? I especially don't like''
part, it's very misleading for users and isn't helpful for them.I know it comes straight from https://github.com/mitchellh/mapstructure/blob/main/mapstructure.go#L417 but can it maybe be made more readable here?
Proposed Solution
I would like the error message to be more readable and do not mention a suspicious
''
part.Alternatives Considered
No response
Additional Information
No response