Debian Codegraph @

.hooks/pre-commit

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 fmtcount=`git ls-files | grep '.go$' | xargs gofmt -l 2>&1 | wc -l`
4 if [ $fmtcount -gt 0 ]; then
5 echo "Some files aren't formatted, please run 'go fmt ./...' to format your source code before committing"
6 exit 1
7 fi
8
9 vetcount=`go tool vet ./ 2>&1 | wc -l`
10 if [ $vetcount -gt 0 ]; then
11 echo "Some files aren't passing vet heuristics, please run 'go vet ./...' to see the errors it flags and correct your source code before committing"
12 exit 1
13 fi
14 exit 0
15
16 # Ensure FIXME lines are removed before commit.
17 fixme_lines=$(git diff --cached | grep ^+ | grep -v pre-commit | grep FIXME | sed 's_^+\s*__g')
18 if [ "$fixme_lines" != "" ]; then
19 echo "Please remove the following lines:"
20 echo -e "$fixme_lines"
21 exit 1
22 fi
23