> On May 24, 2021, at 9:36 PM, Nick Rosbrook <rosbro...@gmail.com> wrote: > > For structs that have a keyed union, e.g. DomainBuildInfo, the TypeUnion > field must be exported so that package users can get/set the fields > within. This means that users are aware of the existence of the > interface type used in those fields (see [1]), so it is awkward that the > interface itself is not exported. However, the single method within the > interface must remain unexported so that users cannot mistakenly "implement" > those interfaces. > > Since there seems to be no reason to do otherwise, export the keyed > union interface types. > > [1] > https://pkg.go.dev/xenbits.xenproject.org/git-http/xen.git/tools/golang/xenlight?tab=doc#DeviceUsbdev > > Signed-off-by: Nick Rosbrook <rosbro...@ainfosec.com> Reviewed-by: George Dunlap <george.dun...@citrix.com> I wonder if at some point we should add documentation to the definitions of specific union types, saying explicitly what union type it implements, and maybe what the Type field should be set to. e.g.: DeviceUsbdevTypeUnionHostdev implements the DeviceUsbdevTypeUnion interface. If DeviceUsbdev.TypeUnion is set to this type, DeviceUsbdev.Type should be set to UsbdevTypeHostdev. Might be overkill tho.
- [RESEND PATCH 00/12] golang/xenlight: domain life cycle supp... Nick Rosbrook
- [RESEND PATCH 01/12] golang/xenlight: update generated ... Nick Rosbrook
- Re: [RESEND PATCH 01/12] golang/xenlight: update ge... George Dunlap
- [RESEND PATCH 02/12] golang/xenlight: fix StringList to... Nick Rosbrook
- Re: [RESEND PATCH 02/12] golang/xenlight: fix Strin... George Dunlap
- [RESEND PATCH 03/12] golang/xenlight: fix string conver... Nick Rosbrook
- Re: [RESEND PATCH 03/12] golang/xenlight: fix strin... George Dunlap
- [RESEND PATCH 04/12] golang/xenlight: export keyed unio... Nick Rosbrook
- Re: [RESEND PATCH 04/12] golang/xenlight: export ke... George Dunlap
- [RESEND PATCH 05/12] golang/xenlight: use struct pointe... Nick Rosbrook
- Re: [RESEND PATCH 05/12] golang/xenlight: use struc... George Dunlap
- [RESEND PATCH 06/12] golang/xenlight: rename Ctx receiv... Nick Rosbrook
- Re: [RESEND PATCH 06/12] golang/xenlight: rename Ct... George Dunlap
- [RESEND PATCH 07/12] golang/xenlight: add logging conve... Nick Rosbrook
- Re: [RESEND PATCH 07/12] golang/xenlight: add loggi... George Dunlap
- Re: [RESEND PATCH 07/12] golang/xenlight: add l... George Dunlap
- Re: [RESEND PATCH 07/12] golang/xenlight: a... Nick Rosbrook
- Re: [RESEND PATCH 07/12] golang/xenlig... George Dunlap
- Re: [RESEND PATCH 07/12] golang/xenlight: add l... Nick Rosbrook