Skip to content

Commit

Permalink
.github: switch to golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
davecheney committed Oct 31, 2023
1 parent 199b7d3 commit aa5ea5b
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 4 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: golangci-lint
on:
push:
branches: [main]
pull_request: {}
jobs:
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
check-latest: true
- uses: actions/checkout@v4
- uses: golangci/golangci-lint-action@v3
with:
version: latest
4 changes: 0 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,5 @@ jobs:
run: go test ./...
- name: Vet
run: go vet ./...
- name: Staticcheck
run: |
go get honnef.co/go/tools/cmd/staticcheck
staticcheck ./...
- name: Format
run: diff -u <(echo -n) <(gofmt -d .)
92 changes: 92 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
run:
go: '1.21'

linters:
enable-all: true
disable:
- bodyclose
- containedctx
- contextcheck
- cyclop
- deadcode # replaced with unused
- depguard # too annoying
- dupl
- dupword
- errcheck
- errchkjson
- errname
- errorlint
- exhaustivestruct # Replaced by exhaustruct.
- exhaustruct
- exhaustive # too annoying, too hard to disable with comments
- forbidigo
- funlen
- gci
- gochecknoglobals
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofumpt
- golint # Replaced by revive.
- gomnd
- ifshort
- inamedparam # too opinionated
- interfacer # deprecated
- ireturn
- lll
- maintidx
- maligned # Replaced by govet
- musttag # flaky, fires on structs which aren't JSON marshalled
- nlreturn
- noctx
- nonamedreturns
- nosnakecase
- paralleltest
- prealloc
- rowserrcheck # disabled because of generics https://github.com/golangci/golangci-lint/issues/2649.
- scopelint # Replaced by exportloopref.
- sqlclosecheck # disabled because of generics https://github.com/golangci/golangci-lint/issues/2649.
- structcheck # replaced with unused
- tagliatelle
- tagalign # too fussy
- testpackage # too annoying
- thelper
- usestdlibvars
- varcheck # Replaced by unused.
- varnamelen
- wastedassign # disabled because of generics
- whitespace
- wrapcheck
- wsl

linters-settings:
gofumpt:
module-path: github.com/pkg/json
gosec:
excludes:
- G112 # Potential slowloris attack
- G114 # Use of net/http serve function that has no support for setting timeouts
- G404 # Insecure random number source (rand)
revive:
rules:
- name: var-naming
disabled: true
stylecheck:
checks: [
"all",
"-ST1003",
"-ST1012"
]
unparam:
check-exported: false
usestdlibvars:
http-method: false
http-status-code: false

issues:
max-issues-per-linter: 0
max-same-issues: 0

0 comments on commit aa5ea5b

Please sign in to comment.