提交 4511a4a4 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3421 from ipfs/feat/test/go-fmt

Add check if go code is formatted
......@@ -75,13 +75,16 @@ PHONY += go_check deps vendor install build nofuse clean uninstall
test: test_expensive
test_short: build test_go_short test_sharness_short
test_short: test_go_fmt build test_go_short test_sharness_short
test_expensive: build test_go_expensive test_sharness_expensive windows_build_check
test_expensive: test_go_fmt build test_go_expensive test_sharness_expensive windows_build_check
test_3node:
$(MAKE) -C test/3nodetest
test_go_fmt:
bin/test-go-fmt
test_go_short:
$(go_test) -test.short ./...
......
#!/usr/bin/env bash
set -euo pipefail
T="$(mktemp)"
find . -name '*.go' | xargs gofmt -l > "$T"
if [ -n "$(cat $T)" ]; then
echo "Following Go code is not formatted."
echo "-----------------------------------"
cat "$T"
echo "-----------------------------------"
echo "Run 'go fmt ./...' in your source directory"
rm -f "$T"
exit 1
fi
rm -f "$T"
......@@ -249,4 +249,3 @@ func (dr *pbDagReader) Seek(offset int64, whence int) (int64, error) {
return 0, errors.New("invalid whence")
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论