On Fri, Jan 10, 2025 at 11:49:39AM +0100, Victor Toso wrote: > This patch handles QAPI enum types and generates its equivalent in Go. > We sort the output based on enum's type name. > > Enums are being handled as strings in Golang. > > 1. For each QAPI enum, we will define a string type in Go to be the > assigned type of this specific enum. > > 2. Naming: CamelCase will be used in any identifier that we want to > export, which is everything. > > Example: > > qapi: > | ## > | # @DisplayProtocol: > | # > | # Display protocols which support changing password options. > | # > | # Since: 7.0 > | ## > | { 'enum': 'DisplayProtocol', > | 'data': [ 'vnc', 'spice' ] } > > go: > | // Display protocols which support changing password options. > | // > | // Since: 7.0 > | type DisplayProtocol string > | > | const ( > | DisplayProtocolVnc DisplayProtocol = "vnc" > | DisplayProtocolSpice DisplayProtocol = "spice" > | ) > > Signed-off-by: Victor Toso <victort...@redhat.com> > --- > scripts/qapi/golang.py | 266 +++++++++++++++++++++++++++++++++++++++++ > scripts/qapi/main.py | 3 + > 2 files changed, 269 insertions(+) > create mode 100644 scripts/qapi/golang.py > > diff --git a/scripts/qapi/golang.py b/scripts/qapi/golang.py > new file mode 100644 > index 0000000000..1e04c99f1c > --- /dev/null > +++ b/scripts/qapi/golang.py > @@ -0,0 +1,266 @@ > +""" > +Golang QAPI generator > +""" > + > +# Copyright (c) 2025 Red Hat Inc. > +# > +# Authors: > +# Victor Toso <victort...@redhat.com> > +# > +# This work is licensed under the terms of the GNU GPL, version 2. > +# See the COPYING file in the top-level directory.
Did you mean to say GPL-2.0-only ? Generally we'd expect new code to be GPL-2.0-or-later. Also we'd now desire "SPDX-License-Identifier: GPL-2.0-or-later" for any newly added files, which reminds me to finish my patches to checkpatch.pl to enforce SPDX usage. 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 :|