clean up lint scripts

This commit is contained in:
Richard van der Hoff 2020-06-04 12:53:08 +01:00
parent 37b7b7158f
commit 47178dc5c5
3 changed files with 15 additions and 4 deletions

View file

@ -5,6 +5,7 @@ set -e
cd `dirname $0`/.. cd `dirname $0`/..
go get golang.org/x/lint/golint go get golang.org/x/lint/golint
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
go get github.com/fzipp/gocyclo go get github.com/fzipp/gocyclo
exec ./hooks/pre-commit ./scripts/lint.sh

View file

@ -26,10 +26,8 @@ cd "$tmpdir"
git --git-dir="${git_dir}" checkout-index -a git --git-dir="${git_dir}" checkout-index -a
# run our checks # run our checks
golint
go fmt go fmt
go vet --shadow ./scripts/lint.sh
gocyclo -over 12 .
go test go test
# we're done with go so can set GIT_DIR # we're done with go so can set GIT_DIR

12
scripts/lint.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
#
# check the go source for lint. This is run by CI, and the pre-commit hook.
# we *don't* check gofmt here, following the advice at
# https://golang.org/doc/go1.10#gofmt
set -eu
golint -set_exit_status
go vet -vettool=$(which shadow)
gocyclo -over 12 .