Skip to content
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

Decoder: show struct field in type mismatch errors #684

Merged
merged 1 commit into from Nov 25, 2021
Merged

Conversation

pelletier
Copy link
Owner

The goal is to provide some context as to why the type were mismatched. This
change only works for that case, on structs. This is the same a encoding/json. A
more general solution would be great, but this would require a broader change in
the decoder, which I don't think is necessary at the moment.

Example error message:

toml: cannot decode TOML integer into struct field toml_test.mystruct.Bar of type string

Fixes #628

The goal is to provide some context as to why the type were mismatched. This
change only works for that case, on structs. This is the same a encoding/json. A
more general solution would be great, but this would require a broader change in
the decoder, which I don't think is necessary at the moment.

Fixes #628
@pelletier pelletier added the feature Issue asking for a new feature in go-toml. label Nov 25, 2021
@pelletier pelletier merged commit b226db6 into v2 Nov 25, 2021
@pelletier pelletier deleted the issue-628 branch November 25, 2021 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issue asking for a new feature in go-toml.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant