On Mon, Nov 06, 2023 at 04:52:12PM +0100, Victor Toso wrote: > On Mon, Nov 06, 2023 at 07:28:04AM -0800, Andrea Bolognani wrote: > > On a partially related note: while I haven't yet looked closely at > > how much effort you've dedicated to producing pretty output, from a > > quick look at generate_struct_type() it seems that the answer is "not > > zero". I think it would be fine to simplify things there and produce > > ugly output, under the assumption that gofmt will be called on the > > generated code immediately afterwards. The C generator doesn't have > > this luxury, but we should take advantage of it. > > Yes, I wholeheartedly agree. The idea of the generator producing > a well formatted Go code came from previous review. I didn't want > to introduce gofmt and friends to QEMU build system, perhaps it > wasn't a big deal but I find it foreign to QEMU for a generated > code that QEMU itself would not use. > > See: https://lists.gnu.org/archive/html/qemu-devel/2023-10/msg01188.html
Noted. Whether or not requiring a pass through gofmt is an issue kind of depends on how we end up shipping these files. What seems the most probable to me is that we'll have a separate repo where we dump the generated files and that Go users will consume via a regular 'import'. Your existing qapi-go repo follows this model. In this context, gofmt is never going to be called as part of the QEMU build process so it doesn't really matter. But maybe there was a discussion around this that I've missed :) -- Andrea Bolognani / Red Hat / Virtualization