[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 7/8] qapi: golang: Add CommandResult type to Go
From: |
Daniel P . Berrangé |
Subject: |
Re: [RFC PATCH v2 7/8] qapi: golang: Add CommandResult type to Go |
Date: |
Tue, 5 Jul 2022 17:49:22 +0100 |
User-agent: |
Mutt/2.2.6 (2022-06-05) |
On Tue, Jul 05, 2022 at 08:46:21AM -0700, Andrea Bolognani wrote:
> On Fri, Jun 17, 2022 at 02:19:31PM +0200, Victor Toso wrote:
> > +type EmptyCommandReturn struct {
> > + CommandId string `json:"id,omitempty"`
> > + Error *QapiError `json:"error,omitempty"`
> > + Name string `json:"-"`
> > +}
>
> Do we need a specific type for this? Can't we just generate an
> appropriately-named type for each of the commands that don't return
> any data? It's not like we would have to write that code manually :)
Yes, I think having an explicit named return struct even for commands
not /currently/ returning data is good, and anticipates future changes
that might add extra return data fields to the QAPI schema.
>
> > +func (r *EmptyCommandReturn) GetCommandName() string {
> > + return r.Name
> > +}
>
> Just like Event.GetName() and Command.GetName(), I'm not convinced we
> should have this.
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|