diff --git a/tpl/macros_struct.twig b/tpl/macros_struct.twig index 61476c5..557e41f 100644 --- a/tpl/macros_struct.twig +++ b/tpl/macros_struct.twig @@ -729,13 +729,19 @@ func (s *{{ name|default(o.name) }}) readFields(reader meta.Reader) error { return errors.Errorf("bad enum value `%d` for `{{ alias }}`", {{ fname }}) } {% elseif type is struct %} - if err := {{ fname }}.Read(reader); err != nil { + if err := reader.BeginContainer("{{ alias }}"); err != nil { + return err + } + if err := {{ fname }}.ReadFields(reader); err != nil { {% if optional %} return nil {% else %} return err {% endif %} } + if err := reader.EndContainer(); err != nil { + return err + } {% elseif type is array %} {% set name = fname|split('.')|last %} {% set size_var = name|lcfirst ~ 'Size' %}