From 6bfb34e0abb050370f00745f18d4d2ff70fc8908 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Tue, 30 Oct 2018 23:52:54 +0300 Subject: [PATCH] move gofmt into a separate script --- gofmt.sh | 14 ++++++++++++++ test.sh | 15 +-------------- 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100755 gofmt.sh diff --git a/gofmt.sh b/gofmt.sh new file mode 100755 index 000000000..0f95fe149 --- /dev/null +++ b/gofmt.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +RETVAL=0 + +for file in $(find . -name '*.go' -not -path './vendor/*') +do + if [ -n "$(gofmt -l $file)" ] + then + echo "$file does not conform to gofmt rules. Run: gofmt -s -w $file" >&2 + RETVAL=1 + fi +done + +exit $RETVAL diff --git a/test.sh b/test.sh index 362e56c21..4df8d7782 100755 --- a/test.sh +++ b/test.sh @@ -4,17 +4,4 @@ set -eux export PACKER_ACC=1 -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 +go test -v -count 1 -timeout 20m ./driver ./iso ./clone