All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Victor Toso <victortoso@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	John Snow <jsnow@redhat.com>,
	Andrea Bolognani <abologna@redhat.com>
Subject: Re: [PATCH v3 1/8] qapi: golang: Generate enum type
Date: Fri, 17 Jan 2025 10:10:51 +0000	[thread overview]
Message-ID: <Z4osq2u_UIQOGfze@redhat.com> (raw)
In-Reply-To: <20250110104946.74960-2-victortoso@redhat.com>

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 <victortoso@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 <victortoso@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 :|



  parent reply	other threads:[~2025-01-17 10:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10 10:49 [PATCH v3 0/8] qapi-go: add generator for Golang interfaces Victor Toso
2025-01-10 10:49 ` [PATCH v3 1/8] qapi: golang: Generate enum type Victor Toso
2025-01-14  8:52   ` Markus Armbruster
2025-01-14  9:38     ` Victor Toso
2025-01-14 10:36     ` Daniel P. Berrangé
2025-01-17 10:10   ` Daniel P. Berrangé [this message]
2025-01-17 10:22     ` Victor Toso
2025-01-10 10:49 ` [PATCH v3 2/8] qapi: golang: Generate alternate types Victor Toso
2025-01-10 10:49 ` [PATCH v3 3/8] qapi: golang: Generate struct types Victor Toso
2025-01-10 10:49 ` [PATCH v3 4/8] qapi: golang: structs: Address nullable members Victor Toso
2025-01-10 10:49 ` [PATCH v3 5/8] qapi: golang: Generate union type Victor Toso
2025-01-10 10:49 ` [PATCH v3 6/8] qapi: golang: Generate event type Victor Toso
2025-01-10 10:49 ` [PATCH v3 7/8] qapi: golang: Generate command type Victor Toso
2025-01-10 10:49 ` [PATCH v3 8/8] docs: add notes on Golang code generator Victor Toso
2025-01-13 12:52 ` [PATCH v3 0/8] qapi-go: add generator for Golang interfaces Markus Armbruster
2025-01-14  9:44   ` Victor Toso
2025-01-17 10:32   ` Daniel P. Berrangé
2025-01-16 21:59 ` Daniel P. Berrangé
2025-01-17 10:44   ` Markus Armbruster
2025-01-29 19:53   ` Victor Toso
2025-02-11 10:25   ` Victor Toso
2025-02-11 11:10     ` Daniel P. Berrangé
2025-02-11 12:08       ` Victor Toso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z4osq2u_UIQOGfze@redhat.com \
    --to=berrange@redhat.com \
    --cc=abologna@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=victortoso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.