Merge pull request #1281 from wking/gofmt-show-diff
Makefile: Use 'git diff' to show gofmt changes
This commit is contained in:
commit
54e76afc03
2 changed files with 2 additions and 22 deletions
3
Makefile
3
Makefile
|
@ -64,7 +64,8 @@ lint: .gopathok
|
||||||
@./.tool/lint
|
@./.tool/lint
|
||||||
|
|
||||||
gofmt:
|
gofmt:
|
||||||
@./hack/verify-gofmt.sh
|
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
|
||||||
|
git diff --exit-code
|
||||||
|
|
||||||
conmon:
|
conmon:
|
||||||
$(MAKE) -C $@
|
$(MAKE) -C $@
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
set -o nounset
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
find_files() {
|
|
||||||
find . -not \( \
|
|
||||||
\( \
|
|
||||||
-wholename '*/vendor/*' \
|
|
||||||
\) -prune \
|
|
||||||
\) -name '*.go'
|
|
||||||
}
|
|
||||||
|
|
||||||
GOFMT="gofmt -s"
|
|
||||||
bad_files=$(find_files | xargs $GOFMT -l)
|
|
||||||
if [[ -n "${bad_files}" ]]; then
|
|
||||||
echo "!!! '$GOFMT' needs to be run on the following files: "
|
|
||||||
echo "${bad_files}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
Loading…
Reference in a new issue