-
-
Notifications
You must be signed in to change notification settings - Fork 176
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When marshaling a struct that has any field and also embeds an aliased primitive, go-json panics. Additionally, if the panic is resolved, the produced bytes are correct, but go-json ignores the aliased primitive when unmarshaling.
func TestEmbeddedPrimitiveAlias(t *testing.T) {
type AliasedPrimitive int
type Combiner struct {
SomeField int
AliasedPrimitive
}
originalCombiner := Combiner{AliasedPrimitive: 7}
bytes, err := json.Marshal(originalCombiner)
assertErr(t, err)
newCombiner := Combiner{}
err = json.Unmarshal(bytes, &newCombiner)
assertErr(t, err)
assertEq(t, "TestEmbeddedPrimitiveAlias", originalCombiner, newCombiner)
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working