Consider these 2 XML documents
<a>
<b nil="true"></b>
</a>
and
<a>
<b type="integer">1</b>
</a>
How can I unmarshal this XML properly in Go to a b
struct field of type int
, without producing a strconv.ParseInt: parsing "": invalid syntax
error in the first case?
omitempty
doesn't seem to work in this case.
Example: http://play.golang.org/p/fbhVJ4zUbl