I'm trying to output a map as XML data, however I receive the following error:
xml: unsupported type: map[string]int
Marshalling maps works fine for JSON so I don't get why it wouldn't work the same for XML. Is using a Struct really the only way?
I ended up solving this by using the xml.Marshaler as suggested by Dave C
Source: https://gist.github.com/jackspirou/4477e37d1f1c043806e0
Now the map can be marshalled by simply calling