Skip to content

Commit

Permalink
Add test_go_fmt to makefile
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Nov 24, 2016
1 parent 1d67c93 commit fff83fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...

Expand Down
13 changes: 13 additions & 0 deletions bin/test-go-fmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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"
fi
rm -f "$T"

0 comments on commit fff83fc

Please sign in to comment.