1
0
Fork 0
qemu/tests/lcitool/libvirt-ci/containers/go-fmt/go-fmt.sh
Daniel Baumann ea34ddeea6
Adding upstream version 1:10.0.2+ds.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-22 14:27:05 +02:00

26 lines
581 B
Bash
Executable file

#!/bin/sh
GOFMT=$(go env GOROOT)/bin/gofmt
find -name '*.go' | xargs $GOFMT -w
git diff > go-fmt.patch
if test -s go-fmt.patch
then
echo
echo "❌ ERROR: some files failed go fmt code style check"
echo
git diff --stat
echo
echo "See the go-fmt patch artifact for full details of mistakes."
echo
echo "For guidance on how to configure Emacs or Vim to automatically"
echo "run go fmt when saving files read"
echo
echo " https://blog.golang.org/gofmt"
echo
exit 1
fi
echo "✔ OK: all files passed go fmt code style check"