Skip to content

Commit

Permalink
replace golint with staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Guthe committed Sep 10, 2021
1 parent 0f69a23 commit 26173e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Expand Up @@ -12,12 +12,12 @@ jobs:
steps:
- checkout
- run:
name: run golint
name: run staticcheck
command: |
make install-golint lint check-no-crypto11-in-signers
make install-staticcheck staticcheck check-no-crypto11-in-signers
make show-lint
make -C tools/autograph-monitor lint
make -C verifier/contentsignature lint
make -C tools/autograph-monitor staticcheck
make -C verifier/contentsignature staticcheck
- run:
name: run gofmt
command: |
Expand Down
17 changes: 5 additions & 12 deletions Makefile
Expand Up @@ -3,17 +3,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PACKAGE_NAMES := github.com/mozilla-services/autograph github.com/mozilla-services/autograph/database github.com/mozilla-services/autograph/formats github.com/mozilla-services/autograph/signer github.com/mozilla-services/autograph/signer/apk2 github.com/mozilla-services/autograph/signer/contentsignature github.com/mozilla-services/autograph/signer/contentsignaturepki github.com/mozilla-services/autograph/signer/genericrsa github.com/mozilla-services/autograph/signer/gpg2 github.com/mozilla-services/autograph/signer/mar github.com/mozilla-services/autograph/signer/xpi github.com/mozilla-services/autograph/verifier/contentsignature

all: generate test vet lint install
all: generate test vet staticcheck install

# update the vendored version of the wait-for-it.sh script
install-wait-for-it:
curl -o bin/wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
sha256sum -c bin/wait-for-it.sh.sha256
chmod +x bin/wait-for-it.sh

install-golint:
go get -u golang.org/x/lint/golint

install-cover:
go get -u golang.org/x/tools/cmd/cover

Expand All @@ -26,7 +23,7 @@ install-staticcheck:
install-go-mod-upgrade:
go get -u github.com/oligot/go-mod-upgrade

install-dev-deps: install-golint install-cover install-goveralls install-go-mod-upgrade
install-dev-deps: install-staticcheck install-cover install-goveralls install-go-mod-upgrade

install:
go install github.com/mozilla-services/autograph
Expand All @@ -37,17 +34,13 @@ vendor:
tag: all
git tag -s $(TAGVER) -a -m "$(TAGMSG)"

lint:
golint $(PACKAGE_NAMES) | tee /tmp/autograph-golint.txt
test 0 -eq $(shell cat /tmp/autograph-golint.txt | grep -Pv 'stutters|suggestions' | wc -l)

# refs: https://github.com/mozilla-services/autograph/issues/247
check-no-crypto11-in-signers:
test 0 -eq $(shell grep -Ri crypto11 signer/*/ | tee /tmp/autograph-crypto11-check.txt | wc -l)

show-lint:
cat /tmp/autograph-golint.txt /tmp/autograph-crypto11-check.txt
rm -f /tmp/autograph-golint.txt /tmp/autograph-crypto11-check.txt
cat /tmp/autograph-staticcheck.txt /tmp/autograph-crypto11-check.txt
rm -f /tmp/autograph-staticcheck.txt /tmp/autograph-crypto11-check.txt

vet:
go vet $(PACKAGE_NAMES)
Expand All @@ -69,7 +62,7 @@ race:
go test -race -covermode=atomic -count=1 $(PACKAGE_NAMES)

staticcheck:
staticcheck $(PACKAGE_NAMES)
staticcheck -go 1.15 $(PACKAGE_NAMES) | tee /tmp/autograph-staticcheck.txt

test:
go test -v -coverprofile coverage.out -covermode=count -count=1 $(PACKAGE_NAMES)
Expand Down
4 changes: 2 additions & 2 deletions tools/autograph-monitor/Makefile
Expand Up @@ -15,8 +15,8 @@ test-cover-report-html:
go tool cover -html=monitor-coverage.out
race:
go test -race -covermode=atomic -count=1 .
lint:
golint *.go
staticcheck:
staticcheck *.go
vet:
go vet *.go
clean:
Expand Down
6 changes: 3 additions & 3 deletions verifier/contentsignature/Makefile
@@ -1,11 +1,11 @@
.DEFAULT_GOAL := all
all: lint vet fmt-fix test race
all: staticcheck vet fmt-fix test race
doc:
go doc .
fmt-fix:
go fmt .
lint:
golint .
staticcheck:
staticcheck .
race:
go test -race -covermode=atomic -count=1 .
showcoverage: test
Expand Down

0 comments on commit 26173e0

Please sign in to comment.