vulncheck: update all.bash
Various fixes are made to the vulncheck/all.bash file.
Change-Id: I9cc0a980f55967aaf66deb9135c62c5b7dd9b44a
Reviewed-on: https://go-review.googlesource.com/c/exp/+/369514
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
diff --git a/vulncheck/all.bash b/vulncheck/all.bash
index 7bdf7ff..70704c7 100755
--- a/vulncheck/all.bash
+++ b/vulncheck/all.bash
@@ -47,9 +47,8 @@
local binary=$(basename $1)
if ! [ -x "$(command -v $binary)" ]; then
info "Installing: $1"
- # Run in a subshell for convenience, so that we don't have to worry about
- # our PWD.
- (set -x; cd && env GO111MODULE=on go get -u $1)
+ # Install the binary in a way that doesn't affect our go.mod file.
+ go install $1@latest
fi
}
@@ -106,13 +105,13 @@
# check_staticcheck runs staticcheck on source files.
check_staticcheck() {
ensure_go_binary honnef.co/go/tools/cmd/staticcheck
- runcmd staticcheck $(go list ./... | grep -v third_party | grep -v internal/doc | grep -v internal/render)
+ runcmd staticcheck ./...
}
# check_misspell runs misspell on source files.
check_misspell() {
ensure_go_binary github.com/client9/misspell/cmd/misspell
- runcmd misspell cmd/**/*.{go,sh} internal/**/* README.md
+ runcmd misspell -error .
}
go_linters() {
@@ -166,6 +165,10 @@
usage
exit 1
esac
+ if [[ $EXIT_CODE != 0 ]]; then
+ err "FAILED; see errors above"
+ fi
+ exit $EXIT_CODE
}
main $@