[Libguestfs] [libnbd PATCH 0/7] Preliminary GoLang cleanups

Eric Blake eblake at redhat.com
Wed Jul 26 17:29:43 UTC 2023


In Laszlo's review of my 64-bit extensions, he pointed out some
questionable code in the GoLang.ml generated code, including some
inconsistencies on whitespace before '('.  Fixing that in turn
inspired me to learn about gofmt, so I attempted to address the issues
it points out.  (One perk of being a modern language: you can enforce
everyone to share the same style, rather than having different camps
each defend their years-long but slightly distinct styles...)

We may want to optionally run gofmt as part of the build process (I
know Tage proposed doing similar with rustfmt), and/or write a further
patch to have the const() blocks in GoLang.ml do a two-pass iteration
over lists (first to learn the maximum column width, second to do the
output).

Eric Blake (7):
  api: Expose "qemu:" meta-context constants
  golang: Export meta-context constants
  golang: Simplify RBool return
  Revert "generator/Go.ml: Simplify copy_uint32_array"
  golang: Use 'gofmt' style recommendations on manual files
  golang: Improve whitespace style in generated bindings
  golang: Enforce coding style during 'make check'

 generator/utils.mli                           |   1 +
 generator/API.ml                              |   9 +-
 generator/C.ml                                |  22 +-
 generator/GoLang.ml                           | 246 +++++++++---------
 generator/OCaml.ml                            |   4 +-
 generator/Python.ml                           |   3 +-
 generator/utils.ml                            |   5 +
 interop/dirty-bitmap.c                        |   6 +-
 golang/Makefile.am                            |   2 +-
 golang/codestyle-tests.sh                     |  45 ++++
 golang/configure/test.go                      |  14 +-
 golang/examples/aio_copy/aio_copy.go          |   7 +-
 golang/examples/simple_copy/simple_copy.go    |   3 +-
 golang/libnbd_220_opt_list_test.go            |   4 +-
 golang/libnbd_230_opt_info_test.go            |  24 +-
 golang/libnbd_240_opt_list_meta_test.go       |  44 ++--
 .../libnbd_245_opt_list_meta_queries_test.go  |  14 +-
 golang/libnbd_250_opt_set_meta_test.go        |  20 +-
 .../libnbd_255_opt_set_meta_queries_test.go   |  14 +-
 golang/libnbd_405_pread_structured_test.go    |  10 +-
 golang/libnbd_460_block_status_test.go        |   4 +-
 golang/libnbd_590_aio_copy_test.go            |  21 +-
 golang/libnbd_620_stats_test.go               |  12 +-
 23 files changed, 307 insertions(+), 227 deletions(-)
 create mode 100755 golang/codestyle-tests.sh


base-commit: 5c2fc3cc7e14146d000b65b191e70d9a0585a395
-- 
2.41.0



More information about the Libguestfs mailing list