Skip to content

Commit

Permalink
fix(gen): initialize pointer generics
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Sep 10, 2024
1 parent 8e1b908 commit 66d4902
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gen/_template/json/encoders_generic.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ func (o *{{ $.Name }}) Decode(d *jx.Decoder{{ if $g.Format }}, format func(*jx.D
return err
}
o.Value = v
{{- else if or ($g.IsStruct) ($g.IsEnum) ($g.IsPointer) ($g.IsSum) ($g.IsAlias) }}
{{- else if $g.IsPointer }}
o.Value = new({{ $g.PointerTo.Go }})
if err := o.Value.Decode(d); err != nil {
return err
}
{{- else if or ($g.IsStruct) ($g.IsEnum) ($g.IsSum) ($g.IsAlias) }}
if err := o.Value.Decode(d); err != nil {
return err
}
Expand Down

0 comments on commit 66d4902

Please sign in to comment.