misc/pre-commit.githook: print gofmt to run

Change-Id: I1e177a2cbbc33bae2afc9bcef8c3da387f5bb303
This commit is contained in:
mpl 2014-06-06 18:33:54 +02:00
parent d5fb600ac2
commit 678d7cc45a
1 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@ fi
#gofmt and trailing space errors
committed=`git diff-index --cached --name-only HEAD`
needFmt=""
for c in $committed
do
if [ ! -e "$c" ]
@ -31,7 +32,7 @@ do
fmtdiff=`git show ":$c" | gofmt -d 2>&1`
if [ -n "$fmtdiff" ]
then
echo "gofmt needed on "$c
needFmt="$needFmt $gofile"
exitstatus=1
fi
fi
@ -47,6 +48,10 @@ do
done
if [ "$exitstatus" -ne 0 ]
then
if [ -n "$needFmt" ]
then
echo "gofmt -w $needFmt"
fi
echo "You can override this check with 'git commit --no-verify'"
fi