add a pre-commit hook
parent
17832294d2
commit
9dac392f26
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
count=`git ls-files | grep '.go$' | xargs gofmt -l | wc -l`
|
||||
if [ $count -gt 0 ]; then
|
||||
echo "Some files aren't formatted, please run 'make format' to format your source code before committing"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
|
@ -376,8 +376,9 @@ packages:
|
|||
package: | packages build package_version_string $(files)
|
||||
mv -f scripts/post_install.sh.bak scripts/post_install.sh
|
||||
|
||||
check_format:
|
||||
git ls-files | grep '.go$$' | xargs gofmt -l
|
||||
|
||||
check:
|
||||
./.hooks/pre-commit
|
||||
|
||||
format:
|
||||
git ls-files | grep '.go$$' | xargs gofmt -w -s
|
||||
|
|
Loading…
Reference in New Issue