elvish/tools/checkstyle-go.sh
Qi Xiao 7d2130141b Make gofmt -s part of checkstyle-go.sh and the style target in Makefile.
Also fix the comment in checkstyle-go.sh, it got the behavior of go{imports fmt}
-d the other way around.
2021-06-09 01:06:00 +01:00

16 lines
380 B
Bash
Executable File

#!/bin/sh -e
# Check if the style of the Go source files is correct without modifying those
# files.
# The grep is needed because `goimports -d` and `gofmt -d` always exits with 0.
echo 'Go files need these changes:'
if find . -name '*.go' | xargs goimports -d | grep .; then
exit 1
fi
if find . -name '*.go' | xargs gofmt -s -d | grep .; then
exit 1
fi
echo ' None!'