Please see below.
https://play.golang.org/p/HXrqLqYIgz
My expected value is:
{"Byte2":0,"Name":"bob"}
But Actual:
{"ByteArray":[0,0,0,0],"Byte2":0,"Name":"bob"}
According to the document (https://golang.org/pkg/encoding/json/)
The empty values are false, 0, any nil pointer or interface value, and any array, slice, map, or string of length zero.
Therefore, json.Marshall() ignores omitempty-tag, because [0 0 0 0] is not zero-length nor 0 nor nil.
And now, to get the expected value, What should we do?