[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RESEND PATCH 04/12] golang/xenlight: export keyed union interface types


  • To: Nick Rosbrook <rosbrookn@xxxxxxxxx>
  • From: George Dunlap <George.Dunlap@xxxxxxxxxx>
  • Date: Fri, 18 Jun 2021 11:19:55 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VG88R5PVfkjFw5U9c/NPxl2z90BrcCABs6qe9+IKPHI=; b=R2mlTAIyiEwwRA7V07F1KXl7wlMgFp6s63a1m+IA5ACXFC3VL09S5vMapu5JekMxMiREZZWvqrDECqsA/LqqwfvpeWxkdzNkv6p3jfLY/f1fFzKsNX2lFIhuP1ZbQhlIm+upVi7ibCJgBqem+RNnh7unpMJOTlV18vHFPsEorRy8KeIQDRmu1gm5DyVzXrV9hLiAhmMM+s/w1fLeAyKDZ2uvPmI24s+R2bTqILz5B08Y+HJejmeqMOgZR/s0TYk7mNOqdNaciwJLuyBSlu+wDp619+JfQtX0ml4EvOJhurJmBdOjAqbdtWf1+0OazyfGQyq/kRW32jeS2MsDmLatlg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SQInDp0VlqLrubc+dyGr2O8W4L2idhnAsvr3rZ6LPd6hdPMr8wGowTrU1BA6Iunqt59gs+mOSjSsGb4i+w1oWEC4rqfCrbDE0bVuinuw0VCU2CXa4vsQGjrWsL51p3v9hIrDogVtRYV4IV+mT8ZaipjpK7faRy373Dv9teBdTYFH87Ut+XIjbiD+iTva23ZBz9oX8f0E8frU14C+2njtXVgkWDkh5Wa2MgCcoweZ716Lg/aCPDGmcAagqEdUbjpS+lH+6VqLOOnTWJdVs3AEzjtaEP87xD/80mxTUHETw6noMSZXMz3PH89hOEeb7ImUZKgnnkX9+UIgk1CYY3RXMA==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Nick Rosbrook" <rosbrookn@xxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 18 Jun 2021 11:20:09 +0000
  • Ironport-hdrordr: A9a23:VQ7jyKpJYfPMCThjzaCZBjsaV5rReYIsimQD101hICG9Evb0qy lhppQmPH7P+VIssRQb8+xoV5PufZqxz/BICOoqTNKftWvdyQiVxehZhOOP/9SJIUbDH4VmpM VdmsZFaeEZDTJB/LvHCAvTKadd/DFQmprY+ts3zB1WPH9Xg7kL1XYfNu4CeHcGPzWvA/ACZf yhz/sCnRWMU1INYP+2A3EUNtKz3eEixPrdEGc77wdM0nj3sQ+V
  • Ironport-sdr: oyNCA5/t2MZ3NC8Mq6uJ6aBzAETaWmhjWTPT537remw0cvWzitjmpkEv5zs3GK+c/gyv9idzc8 rX2v2UEjeqO5RLIO8P5pkWD7jWCvfdXmIVBv29nNxvuj5EvWjM0j4hSLCFWiSJzNvNxMDJlECJ ZQD6E9JxkXb+9IMGFcQUZgxRnF/AJPPM9WzcSA24SqT62JlvPbdEmXIAm/hFik4QT586GpTfuX NF632F/oXfseYZQakklH1K1fHBJAdZDhhV8MBTkS2VMIZ2ZTd8K27jNHLYdUfqpDU7qsbKNSC8 djE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXUNytQQDjetM7BUSIz+lNSh+ZXasZxf6A
  • Thread-topic: [RESEND PATCH 04/12] golang/xenlight: export keyed union interface types


> On May 24, 2021, at 9:36 PM, Nick Rosbrook <rosbrookn@xxxxxxxxx> 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 <rosbrookn@xxxxxxxxxxxx>

Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>

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.




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.