Go version
go version go1.24.0 windows/amd64
Output of go env
in your module/workspace:
!
What did you do?
using this code:
package main
import "encoding/xml"
func main() {
var value struct {
Envelope struct {
Soap string `xml:"soap,attr"`
}
}
_, err := xml.Marshal(value.Envelope)
if err != nil {
panic(err)
}
}
I get this result:
xml: unsupported type: struct { Soap string "xml:\"soap,attr\"" }
this result appears to be invalid:
the name of the struct field used to obtain the data
https://go.dev/pkg/encoding/xml?m=old#Marshal
from the documentation, xml.Marshal
should take the name for XML element from the name of the struct field, in this case "Envelope"
What did you see happen?
!
What did you expect to see?
!