diff --git a/test/Makefile b/test/Makefile index 17c22300a..a6d99dab9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -43,16 +43,16 @@ bin/iptb: $(call find_go_files, $(IPTB_SRC)) IPFS-BUILD-OPTIONS test: test_expensive -test_expensive: +test_expensive: verify_gofmt cd sharness && make TEST_EXPENSIVE=1 cd 3nodetest && make cd dependencies && make -test_cheap: +test_cheap: verify_gofmt cd sharness && make cd 3nodetest && make -test_race: +test_race: verify_gofmt cd sharness && make GOFLAGS=-race TEST_EXPENSIVE=1 cd 3nodetest && make GOFLAGS=-race cd dependencies && make GOFLAGS=-race @@ -60,4 +60,7 @@ test_race: IPFS-BUILD-OPTIONS: FORCE @bin/checkflags '$@' '$(GOFLAGS)' '*** new Go flags ***' +verify_gofmt: + bin/verify-go-fmt.sh + .PHONY: all clean FORCE diff --git a/test/bin/verify-go-fmt.sh b/test/bin/verify-go-fmt.sh new file mode 100755 index 000000000..227d2d82e --- /dev/null +++ b/test/bin/verify-go-fmt.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +#TODO add go lint and go vet + +verify_gofmt() { + GOFMT="gofmt -s" + cd "$(git rev-parse --show-toplevel)" + bad_files=$($GOFMT -l . | grep -v Godeps) + cd - + if [[ -n $bad_files ]]; then + echo "You have to run '$GOFMT' on these files:" + echo "$bad_files" + false + else + true + fi +} + +verify_gofmt