From 4dcd6c1f9dc84142e88bb5038fac5b0328f8ea80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Jouannet?= Date: Tue, 30 Oct 2018 21:46:36 +0100 Subject: [PATCH] add gofmt to test.sh (#167) add gofmt to test.sh, the script exit 1 if one go files doesn't respect gofmt rules --- test.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 4df8d7782..362e56c21 100755 --- a/test.sh +++ b/test.sh @@ -4,4 +4,17 @@ set -eux export PACKER_ACC=1 -go test -v -count 1 -timeout 20m ./driver ./iso ./clone +RETVAL=0 + +for file in $(find ./ -type f ! -path "./vendor/*" -name '*.go' -print) +do + if [[ -n "$(gofmt -l "$file")" ]] + then + echo -e "$file does not conform to gofmt rules. Run: gofmt -s -w $file" + RETVAL=1 + fi +done + +exit $RETVAL + +go test -v -count 1 -timeout 20m ./driver ./iso ./clone \ No newline at end of file