Skip to content

Commit

Permalink
ci: Add golangci-lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgeiser authored and caarlos0 committed Nov 7, 2020
1 parent ce7bf71 commit 6d6afb4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "Install golangci-lint"
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $HOME/bin latest
- name: Set up Go
uses: actions/setup-go@v2
with:
Expand All @@ -29,6 +32,10 @@ jobs:
${{ runner.os }}-go-
- name: Dependencies
run: go mod tidy
- name: "Run golangci-lint"
run: |
export PATH=$HOME/bin:$PATH
golangci-lint run
- name: Test
run: go test -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./...
- name: Upload coverage
Expand Down
43 changes: 43 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
linters:
enable-all: true
disable:
- godox
- wsl
- gomnd
- testpackage
- nolintlint
- gofumpt
- nlreturn
- gci
linters-settings:
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/goreleaser/fileglob
govet:
check-shadowing: true
errcheck:
ignore: ^Close.*,fmt:.*,github.com/pkg/errors:^Wrap.*,os:^Setenv$
lll:
line-length: 200
golint:
min-confidence: .8
nakedret:
max-func-lines: 0
gocritic:
disabled-checks:
- whyNoLint
enabled-tags:
- style
- performance
issues:
exclude-rules:
- text: "G104" # gosec G104 is caught by errcheck
linters:
- gosec

0 comments on commit 6d6afb4

Please sign in to comment.