@cryptotaxi247 / kubo / commits / 21c7ec8c3

Add test_go_fmt to makefile

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Nov 24, 2016 at 20:06 UTC 21c7ec8c35354a7f2690b2d2855a7b75b8273e95
2 files changed +20 -2
Makefile
+5 -2
@@ -75,13 +75,16 @@ PHONY += go_check deps vendor install build nofuse clean uninstall
75
76 test: test_expensive
77
78 -test_short: build test_go_short test_sharness_short
78 +test_short: test_go_fmt build test_go_short test_sharness_short
79
80 -test_expensive: build test_go_expensive test_sharness_expensive windows_build_check
80 +test_expensive: test_go_fmt build test_go_expensive test_sharness_expensive windows_build_check
81
82 test_3node:
83 $(MAKE) -C test/3nodetest
84
85 +test_go_fmt:
86 + bin/test-go-fmt
87 +
88 test_go_short:
89 $(go_test) -test.short ./...
90
bin/test-go-fmt new
+15
@@ -0,0 +1,15 @@
1 +#!/usr/bin/env bash
2 +set -euo pipefail
3 +T="$(mktemp)"
4 +find . -name '*.go' | xargs gofmt -l > "$T"
5 +
6 +if [ -n "$(cat $T)" ]; then
7 + echo "Following Go code is not formatted."
8 + echo "-----------------------------------"
9 + cat "$T"
10 + echo "-----------------------------------"
11 + echo "Run 'go fmt ./...' in your source directory"
12 + rm -f "$T"
13 + exit 1
14 +fi
15 +rm -f "$T"