On Wed, Jul 26, 2023 at 12:50:03PM -0500, Eric Blake wrote:
I ran:
gofmt -s -w $(git ls-files -- '**/*.go')
then touched up a few comments in test 590 where it mis-interpreted
our intentions of having a single sentence that occupies more than 80
columns.
Touching up manually isn't a good idea if you want to enforce
'go fmt' compliance, as you'll want contributors to be able to
set their editors to automatically run 'go fmt' upon save and
submit as is.
Most of the changes are whitespace fixes (consistent use of TAB,
altering the whitespace around operators), using preferred ordering
for imports, and eliding excess syntax (unneeded () or ;).
This patch only adjusts files directly in git control. Later patches
will tackle (most) Go style problems in the generated files, then
automate a way to ensure we don't regress.
libvirt-ci provides a container image for running & reporting
go fmt violations. Since you're using lcitool manifest, just
make this change
$ git diff ci/manifest.yml
diff --git a/ci/manifest.yml b/ci/manifest.yml
index f7b1daf..a5f3e66 100644
--- a/ci/manifest.yml
+++ b/ci/manifest.yml
@@ -6,6 +6,7 @@ gitlab:
project: libnbd
jobs:
check-dco: false
+ go-fmt: true
targets:
alpine-315: x86_64
and re-generate, and it'll enforce style on *.go tree-wide.
libvirt-ci manifest also supports 'cargo-fmt' for rust, 'black' for
python, and 'clang-format' for C too, enabled in the same way.
With regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|