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:
@ -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
19
test/bin/verify-go-fmt.sh
Executable 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
|
||||
Reference in New Issue
Block a user