1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-24 15:12:55 +08:00

Add gofmt check

This commit is contained in:
rht
2015-05-19 00:00:53 +07:00
parent ac7edddb94
commit 1e38f71a38
2 changed files with 25 additions and 3 deletions

View File

@ -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

19
test/bin/verify-go-fmt.sh Executable file
View File

@ -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