We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Related to #362
When unmarshaling a struct with an embedded pointer to an aliased primitive, the resulting struct omits the the pointer field leaving it nil.
nil
The original struct is correctly serialized. For example, in the test below, the AliasedPrimitive field has a value of 7.
func TestIssue372(t *testing.T) { type AliasedPrimitive int type Combiner struct { SomeField int *AliasedPrimitive } aliasedPrimitive := AliasedPrimitive(7) originalCombiner := Combiner{AliasedPrimitive: &aliasedPrimitive} b, err := json.Marshal(originalCombiner) assertErr(t, err) newCombiner := Combiner{} err = json.Unmarshal(b, &newCombiner) assertErr(t, err) assertEq(t, "TestEmbeddedPrimitiveAlias", *originalCombiner.AliasedPrimitive, *newCombiner.AliasedPrimitive) }
panics due to newCombiner.AliasedPrimitive being nil.
newCombiner.AliasedPrimitive
The text was updated successfully, but these errors were encountered:
fix: support for embedding alias of primitive types
f0e6a54
fix goccy#372
Merge pull request #378 from orisano/fix/#372
554506d
Fix embedded primitive type encoding using alias
Successfully merging a pull request may close this issue.
Related to #362
When unmarshaling a struct with an embedded pointer to an aliased primitive, the resulting struct omits the the pointer field leaving it
nil
.The original struct is correctly serialized. For example, in the test below, the AliasedPrimitive field has a value of 7.
panics due to
newCombiner.AliasedPrimitive
beingnil
.The text was updated successfully, but these errors were encountered: