mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
move the contributing hook into hack, and use curl in the same way as the gofmt above
and remove the fmt-check one we don't document tianon tells me they're called GitHub, not Github :) Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@fosiki.com> (github: SvenDowideit) Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
This commit is contained in:
committed by
Sven Dowideit
parent
3cb5bc5ae5
commit
7c55cbd4c9
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This pre-commit hook will abort if a committed file doesn't pass gofmt.
|
||||
# By Even Shaw <edsrzf@gmail.com>
|
||||
# http://github.com/edsrzf/gofmt-git-hook
|
||||
|
||||
test_fmt() {
|
||||
hash gofmt 2>&- || { echo >&2 "gofmt not in PATH."; exit 1; }
|
||||
IFS='
|
||||
'
|
||||
for file in `git diff --cached --name-only --diff-filter=ACM | grep '\.go$'`
|
||||
do
|
||||
output=`git cat-file -p :$file | gofmt -l 2>&1`
|
||||
if test $? -ne 0
|
||||
then
|
||||
output=`echo "$output" | sed "s,<standard input>,$file,"`
|
||||
syntaxerrors="${list}${output}\n"
|
||||
elif test -n "$output"
|
||||
then
|
||||
list="${list}${file}\n"
|
||||
fi
|
||||
done
|
||||
exitcode=0
|
||||
if test -n "$syntaxerrors"
|
||||
then
|
||||
echo >&2 "gofmt found syntax errors:"
|
||||
printf "$syntaxerrors"
|
||||
exitcode=1
|
||||
fi
|
||||
if test -n "$list"
|
||||
then
|
||||
echo >&2 "gofmt needs to format these files (run gofmt -w and git add):"
|
||||
printf "$list"
|
||||
exitcode=1
|
||||
fi
|
||||
exit $exitcode
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--about )
|
||||
echo "Check Go code formatting"
|
||||
;;
|
||||
* )
|
||||
test_fmt
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user