Skip to content

qapi-go: add generator for Golang interface

Victor Toso qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 31 repliesIn review
  2. v19 patches 34 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11qapi: re-establish linting baselinescripts/qapi/gen.py scripts/qapi/parser.py+4 -30 replies
2/11scripts: qapi: black format main.pyscripts/qapi/main.py+48 -285 replies
3/11qapi: golang: Generate qapi's enum types in Goscripts/qapi/golang.py scripts/qapi/main.py+176 -00 replies
4/11qapi: golang: Generate qapi's alternate types in Goscripts/qapi/golang.py+298 -37 replies
5/11qapi: golang: Generate qapi's struct types in Goscripts/qapi/golang.py+155 -10 replies
6/11qapi: golang: structs: Address 'null' membersscripts/qapi/golang.py+228 -150 replies
7/11qapi: golang: Generate qapi's union types in Goscripts/qapi/golang.py+217 -114 replies
8/11qapi: golang: Generate qapi's event types in Goscripts/qapi/golang.py+119 -33 replies
9/11qapi: golang: Generate qapi's command types in Goscripts/qapi/golang.py+114 -20 replies
10/11qapi: golang: Add CommandResult type to Goscripts/qapi/golang.py+92 -123 replies
11/11docs: add notes on Golang code generatordocs/devel/index-build.rst docs/devel/qapi-golang-code-gen.rst+377 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/11] qapi-go: add generator for Golang interface

This patch series intent is to introduce a generator that produces a Go module for Go applications to interact over QMP with QEMU.

This is the second iteration:
v1: https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg06734.html

I've pushed this series in my gitlab fork:
https://gitlab.com/victortoso/qemu/-/tree/qapi-golang-v2

I've also generated the qapi-go module over QEMU tags: v7.0.0, v7.1.0, v7.2.6, v8.0.0 and v8.1.0, see the commits history here:
https://gitlab.com/victortoso/qapi-go/-/commits/qapi-golang-v2-by-tags

I've also generated the qapi-go module over each commit of this series, see the commits history here (using previous refered qapi-golang-v2)
https://gitlab.com/victortoso/qapi-go/-/commits/qapi-golang-v2-by-patch

Cheers,
Victor

* Changes:
- All patches were rebased using black python formatting tool, awesome. (John) https://black.readthedocs.io/en/stable/
- All patches were tested with flake8 and pylint. Minor complains remains. (John)
- All generated types are sorted in alphabetical order (Daniel)
- Using utf8 instead of ascii encoding of output files
- Improved commit logs
- renamed QapiError -> QAPIError (Daniel)
- QAPIError's Error() returns only the description (Daniel)
- Used more type hints (Where I could) (John)
- Removed typehint from self in the Class implementation (John)
- The Go code that is generated is now well formated. gofmt -w and goimport -w don't change a thing.
- Added a fix from John
https://lists.gnu.org/archive/html/qemu-devel/2023-10/msg01305.html
- Added a tangent fix suggestion to main.py "scripts: qapi: black format main.py"

John Snow (1):
qapi: re-establish linting baseline

Victor Toso (10):
scripts: qapi: black format main.py
qapi: golang: Generate qapi's enum types in Go
qapi: golang: Generate qapi's alternate types in Go
qapi: golang: Generate qapi's struct types in Go
qapi: golang: structs: Address 'null' members
qapi: golang: Generate qapi's union types in Go
qapi: golang: Generate qapi's event types in Go
qapi: golang: Generate qapi's command types in Go
qapi: golang: Add CommandResult type to Go
docs: add notes on Golang code generator

 docs/devel/index-build.rst          |    1 +
 docs/devel/qapi-golang-code-gen.rst |  376 ++++++++
 scripts/qapi/gen.py                 |    2 +-
 scripts/qapi/golang.py              | 1349 +++++++++++++++++++++++++++
 scripts/qapi/main.py                |   79 +-
 scripts/qapi/parser.py              |    5 +-
 6 files changed, 1781 insertions(+), 31 deletions(-)
 create mode 100644 docs/devel/qapi-golang-code-gen.rst
 create mode 100644 scripts/qapi/golang.py
Signature · 1 line
2.41.0