On Fri, Jul 28, 2023 at 10:29:42AM +0200, Laszlo Ersek wrote:
I also debated about splitting this patch into two (yes, more gruntwork): one to address space before '(', and the other to address leading indentation. Lines like this would be touched by both patches if I split.
I wouldn't insist on such a split. :)
The benefit of such a split: changing "int (r)" to "int(r)" is non-controversial, while changing " line" to "\tline" could be reverted if we find a cleaner way to get pr to do indentation on our behalf.
There's also the idea that if the main thing that gofmt still complains about is 4 spaces vs. TAB, we could use coreutils' unexpand(1) on platforms where 'gofmt' is not installed (although I'm not sure unexpand is portable enough to consider it likely to be installed on other systems). The more I think about this, the more I'm leaning towards injecting gofmt into the pipeline, especially since Tage has already proposed injecting rustfmt into the pipeline.
Still, cleaning up the ' (' to be consistent with language idioms seems worthwhile, even if I punt on the TAB issue.
OK, sounds like a plan -- "separate out the space removal from before parens, and integrate gofmt into the build process".
I've pushed 1-3, 5-6 as 5c2fc3cc..bc68eae4 (splitting up a couple of them, and without any \t in patch 6). I'm still playing with Dan's idea for using CI to run gofmt, and/or how to build gofmt into the tool chain, rather than immediately pushing patch 7. In the short term, I'm moving back to my work on the 64-bit extension patches.
Regarding the new gofmt dependency: can we assume that wherever go exists, gofmt also exists? (On RHEL9, they are both in golang-bin.) IOW, whenever we build the go bindings, we can also format them. This seems to have come up during the discussion, but I don't remember the verdict.
That has been my assumption as well, but a well-written build dependency will tolerate gofmt being missing. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org