Skip to content

Commit

Permalink
Switch to golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Dec 30, 2022
1 parent 71b9067 commit 7042fc1
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 10 deletions.
60 changes: 60 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Config file for golangci-lint
run:
concurrency: 4
deadline: 1m
issues-exit-code: 1
tests: true
skip-dirs:
- .github
- doc
- docker
- logos
- scripts
- util
modules-download-mode: readonly

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

linters:
disable-all: true
enable:
# - errcheck
# - gofmt
# - goimports
- gosimple
- govet
- ineffassign
# - maligned
- megacheck
- misspell
# - prealloc
- staticcheck
# - unparam
- unused

linters-settings:
errcheck:
check-type-assertions: false
check-blank: false
govet:
check-shadowing: false
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
gofmt:
simple: true
misspell:
locale: US
unparam:
check-exported: false
prealloc:
simple: true
range-loops: true
for-loops: true
15 changes: 5 additions & 10 deletions scripts/runTestsOnTravis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
set -e

if [ "$1" = "compile" ]; then

# We will compile and run some vet, spelling and some other checks.

go install honnef.co/go/tools/cmd/staticcheck@latest;
go install github.com/client9/misspell/cmd/misspell@latest;
GO_LIST=$(go list ./...);
# First check that NATS builds.
go build;
$(exit $(go fmt $GO_LIST | wc -l));
go vet $GO_LIST;
find . -type f -name "*.go" | xargs misspell -error -locale US;
staticcheck -tags=js_chaos_tests $GO_LIST

# Now run the linters.
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
golangci-lint run;
if [ "$TRAVIS_TAG" != "" ]; then
go test -race -v -run=TestVersionMatchesTag ./server -count=1 -vet=off
fi
Expand Down

0 comments on commit 7042fc1

Please sign in to comment.