[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: George Dunlap <George.Dunlap@xxxxxxxxxx>
  • Date: Thu, 4 Jun 2020 16:40:40 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 04 Jun 2020 16:40:51 +0000
  • Ironport-sdr: RaUK3moPoeydGah68lZURMNhv2cBJk0MzoqWx6HAWOF1NxjHAgyjvO2s9vS5nbyIkRwu5HnLun 9TLfH3/yWl5s3iGXl12qEYXDzmcOD524fsIsoMiI6dKXjpVpNA+8W/q3hGQkVvCDe9gB+r6Tgg aCy5lhPbs6OzM/xdgsnG8eiThEnki8HV7IVOxbUSE/oAA+O0AaxqrRy9RmO8y4khbvNaBXL7wZ 0h/9qthVh244kJlYJmEXDXFeQyamkebGS87WMNGPN8lMmGNUsmlc09kUXef28tDMvAWvUbYj4Z AoY=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWM6tS08XNp9FsPk2dfrAVrD4GiajIlOUA
  • Thread-topic: [PATCH v2 1/5] libxl: Generate golang bindings in libxl Makefile


> On May 26, 2020, at 11:16 PM, George Dunlap <george.dunlap@xxxxxxxxxx> wrote:
> 
> The generated golang bindings (types.gen.go and helpers.gen.go) are
> left checked in so that they can be fetched from xenbits using the
> golang tooling.  This means that they must be updated whenever
> libxl_types.idl (or other dependencies) are updated.  However, the
> golang bindings are only built optionally; we can't assume that anyone
> updating libxl_types.idl will also descend into the tools/golang tree
> to re-generate the bindings.
> 
> Fix this by re-generating the golang bindings from the libxl Makefile
> when the IDL dependencies are updated, so that anyone who updates
> libxl_types.idl will also end up updating the golang generated files
> as well.
> 
> - Make a variable for the generated files, and a target in
>   xenlight/Makefile which will only re-generate the files.
> 
> - Add a target in libxl/Makefile to call external idl generation
>   targets (currently only golang).

So as written this turns out not to work correctly:  `gengotypes.py` spits out 
syntactically valid but unformatted Go code, and then runs `go fmt` on it to 
get the right style (including tabs, &c).  But the error code of `go fmt` isn’t 
checked; so on a system without go installed, if the build system decides it 
needs to re-run `gengotypes.py` for whatever reason, the build succeeds but the 
tree ends up “dirtied” with an unformatted version fo the generated text.

The simplest short-term way to fix this would be to remove the `go fmt` call 
from `gengotypes.py`.  It’s actually relatively unusual for generated code to 
look pretty (or even be looked at).  We could also consider adding in some 
“manual” formatting in gengotypes.py, like indentation, so that it doesn’t look 
too terrible.

Nick, do you have time to work on a patch like that?

 -George

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.