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
The text was updated successfully, but these errors were encountered:
loeffel-io
changed the title
Unmarshal "incomplete" struct is bad
Unmarshal "incomplete" struct take the wrong field
Oct 13, 2018
loeffel-io
changed the title
Unmarshal "incomplete" struct take the wrong field
Unmarshal of "incomplete" struct take the wrong field
Oct 13, 2018
ysmolski
changed the title
Unmarshal of "incomplete" struct take the wrong field
encoding/json: for "incomplete" structs Unmarshal matches wrong tag while the exact tag is not matched
Oct 13, 2018
Although this is a feature of decoder to match case-insensitively fields with tags, it also means that decoder "prefers" the last matched item from the json: https://play.golang.org/p/ErQhH1aHNrZ
The same happens for struct fields: https://play.golang.org/p/4vwJF-c2Za9. Notice how part.AA has different values for each json string. Last matched value from the json, that is.
Yes, it seems like a duplicate to me. Even if the test case weren't exactly the same, it sounds to me like the solution should tackle both at the same time.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?https://play.golang.org
What did you do?
https://play.golang.org/p/0wQ7oqBrNYC
What did you expect to see?
{golang}
What did you see instead?
{google}
The text was updated successfully, but these errors were encountered: