This behavior is hardwired, see the xml/encoding source for the handful of []byte special cases along the lines of:
if reflect.Slice && slice element type == reflect.Uint8
While govmomi maintains a fork of Go's xml/encoding package, we prefer to further diverge.
Proposed solution is to use a 'ByteSlice' type that implements xml marshaling as vCenter does,
but otherwise behaves just as []byte does.
Commits that follow enhance vcsim and govc support around various []byte fields.
Go's encoding/xml package and vCenter marshal '[]byte' differently: Go encodes the entire array in a single xml element, for example:
vCenter encodes each byte of the array in its own xml element, example with same data as above:
This behavior is hardwired, see the xml/encoding source for the handful of []byte special cases along the lines of:
While govmomi maintains a fork of Go's xml/encoding package, we prefer to further diverge. Proposed solution is to use a 'ByteSlice' type that implements xml marshaling as vCenter does, but otherwise behaves just as
[]byte
does.Commits that follow enhance vcsim and govc support around various
[]byte
fields.Fixes #1977 Fixes #3469