Add staticcheck to CI (#4731)

This adds staticcheck to our "lints" CI, with a list of excluded checks. Some of these are checks that we don't care about much (like error string capitalization). Others are nice to fix (possible nil pointer dereferences in _test.go files), but we'd like to land the automated checking first to catch any new issues, then later winnow down the list.

This builds on #4726, #4725, and #4722, which addressed some of the categories of findings from staticcheck.
This commit is contained in:
Jacob Hoffman-Andrews 2020-04-06 17:37:19 -07:00 committed by GitHub
parent 28dbbce8da
commit 48942db1a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -68,6 +68,7 @@ function run_test_coverage() {
# Run various linters.
#
if [[ "$RUN" =~ "lints" ]] ; then
staticcheck -checks=inherit,-S1021,-ST1005,-SA1019,-S1030,-S1004,-S1032,-ST1017,-ST1013,-SA6003,-SA5011,-ST1012,-S1029,-SA2002 ./...
run_and_expect_silence go vet ./...
# Run gofmt instead of go fmt because of
# https://github.com/golang/go/issues/31976

View File

@ -42,7 +42,12 @@ GO111MODULE=on go get \
github.com/modocache/gover \
golang.org/x/tools/cover \
golang.org/x/tools/cmd/stringer \
github.com/gordonklaus/ineffassign
github.com/gordonklaus/ineffassign \
honnef.co/go/tools/cmd/staticcheck@2020.1.3
# Pebble's latest version is v2+, but it's not properly go mod compatible, so we
# fetch it in GOPATH mode.
go get github.com/letsencrypt/pebble/cmd/pebble-challtestsrv
# Pebble's latest version is v2+, but it's not properly go mod compatible, so we
# fetch it in GOPATH mode.