I usually create a separate struct for each part of the union and provide interface methods for un/marshalling. It is more work, but I find it to be much cleaner in the end: once those are created the union doesn't "leak" into the go code.
On Tue, Apr 18, 2017 at 8:41 AM, Vasiliy Tolstov <v.tols...@selfip.ru> wrote: > I have Some C struct like > https://libvirt.org/html/libvirt-libvirt-common.html#virTypedParameter > > that needs to be binary Unmarshal to go native interface (xdr2), does > it possible to represent via one go struct all needed things, or i > need to create for each type struct and provide needed interface > methods ? > > -- > Vasiliy Tolstov, > e-mail: v.tols...@selfip.ru > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.