Standard library / encoding/xml
encoding/xml.TagPathError
Error describing incompatible struct field paths with the owning Go type and conflicting fields. Expected stdout: 'true A B\n'.
Formal Syntax & Structure
go syntaxgo
type TagPathError struct { Struct reflect.Type Field1, Tag1 string Field2, Tag2 string}Working Example
Example Snippetgo
package main
import ( "encoding/xml" "errors" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { _, e := xml.Marshal(struct { A string `xml:"x"` B string `xml:"x>y"` }{A: "a", B: "b"}) var te *xml.TagPathError fmt.Println(errors.As(e, &te), te.Field1, te.Field2)}