Skip to content

Commit 67dbca9

Browse files
committed
encoding/xml: use struct literals with named fields
1 parent d5764cf commit 67dbca9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/encoding/xml/marshal.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
582582
continue
583583
}
584584

585-
name := Name{finfo.xmlns, joinPrefixed(finfo.prefix, finfo.name)}
585+
name := Name{Space: finfo.xmlns, Local: joinPrefixed(finfo.prefix, finfo.name)}
586586
if err := p.marshalAttr(&start, name, fv); err != nil {
587587
return err
588588
}
@@ -592,7 +592,7 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
592592
if tinfo.xmlname != nil && start.Name.Space == "" &&
593593
tinfo.xmlname.xmlns == "" && tinfo.xmlname.name == "" &&
594594
len(p.elements) != 0 && p.elements[len(p.elements)-1].xmlns != "" {
595-
start.Attr = append(start.Attr, Attr{Name{"", xmlnsPrefix}, ""})
595+
start.Attr = append(start.Attr, Attr{Name{Space: "", Local: xmlnsPrefix}, ""})
596596
}
597597

598598
if err := p.writeStart(&start); err != nil {

0 commit comments

Comments
 (0)