kubo/bin/test-go-fmt
Jakub Sztandera 21c7ec8c35
Add test_go_fmt to makefile
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-11-24 22:14:59 +01:00

16 lines
353 B
Bash
Executable File

#!/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"