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
In the following example there are 2 sets of structs (A1, B1, C1) and (A2, B2, C2).
Each Ci contains 2 embedded structs Ai and Bi (with the inline tags).
Ci are unmarshalled using the same input:
a: 3
b: 2
All structs from the first triplet use default unmarshalers and everything works as expected.
B2 from the second triplet has custom unmarshaler.
This might not be important but the unmarshaler uses type indirection (to first unmarshal into alias and then be able to validate B2 fields).
As a result of decoding data into C2 ValueA is filled with the default value 0.
There are also 2 blocks of commented unmarshalers (for structs A2 and C2) in the example program. If either of them gets uncommented then the second experiment yields the same result as the first one.
In the following example there are 2 sets of structs (A1, B1, C1) and (A2, B2, C2).
Each Ci contains 2 embedded structs Ai and Bi (with the inline tags).
Ci are unmarshalled using the same input:
All structs from the first triplet use default unmarshalers and everything works as expected.
B2 from the second triplet has custom unmarshaler.
This might not be important but the unmarshaler uses type indirection (to first unmarshal into alias and then be able to validate B2 fields).
As a result of decoding data into C2 ValueA is filled with the default value 0.
There are also 2 blocks of commented unmarshalers (for structs A2 and C2) in the example program. If either of them gets uncommented then the second experiment yields the same result as the first one.
Output:
The question is, am I doing something wrong here or this is a bug?
The text was updated successfully, but these errors were encountered: