On 10/7/19 4:12 PM, Nick Rosbrook wrote:
> From: Nick Rosbrook <rosbro...@ainfosec.com>
> 
> Re-define Uuid as [16]byte and implement fromC, toC, and String functions.
> 
> Signed-off-by: Nick Rosbrook <rosbro...@ainfosec.com>
> ---
> Cc: George Dunlap <george.dun...@citrix.com>
> Cc: Ian Jackson <ian.jack...@eu.citrix.com>
> Cc: Wei Liu <w...@xen.org>
> 
>  tools/golang/xenlight/xenlight.go | 37 +++++++++++++++++++++++++++++--
>  1 file changed, 35 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/golang/xenlight/xenlight.go 
> b/tools/golang/xenlight/xenlight.go
> index 9c384485e1..3e3753f92e 100644
> --- a/tools/golang/xenlight/xenlight.go
> +++ b/tools/golang/xenlight/xenlight.go
> @@ -86,7 +86,40 @@ type Devid int
>  
>  type MemKB uint64
>  
> -type Uuid C.libxl_uuid
> +// Uuid is a domain UUID.
> +type Uuid [16]byte
> +
> +// String formats a Uuid in the form "xxxx-xx-xx-xx-xxxxxx".
> +func (u Uuid) String() string {
> +     s := "%x%x%x%x-%x%x-%x%x-%x%x-%x%x%x%x%x%x"
> +     opts := make([]interface{}, 16)
> +
> +     for i, v := range u {
> +             opts[i] = v
> +     }
> +
> +     return fmt.Sprintf(s, opts...)

*Sigh*  Is there really no better way to do this?  (Not complaining at
you, more at the language really...)

Everything else looks good.

 -George



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to