chore: update linter

This commit is contained in:
Fernandez Ludovic 2025-03-25 03:34:46 +01:00
parent 38dd4b1898
commit 00ebf584ff
3 changed files with 96 additions and 100 deletions

View File

@ -3,11 +3,9 @@ name: Go Matrix
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:

View File

@ -3,11 +3,9 @@ name: Main
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:
@ -17,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.64.6
GOLANGCI_LINT_VERSION: v2.0.1
CGO_ENABLED: 0
steps:
@ -36,7 +34,7 @@ jobs:
# https://golangci-lint.run/usage/install#other-ci
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
golangci-lint --version
- name: Make

View File

@ -1,72 +1,72 @@
linters:
enable-all: true
disable:
- tenv # deprecated
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
- cyclop # duplicate of gocyclo
- lll
- dupl
- prealloc
- wsl
- nlreturn
- mnd
- testpackage
- paralleltest
- tparallel
- err113
- wrapcheck
- exhaustive
- exhaustruct
- varnamelen
- nilnil
version: "2"
linters-settings:
govet:
enable-all: true
disable:
- fieldalignment
gocyclo:
min-complexity: 12
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: US
formatters:
enable:
- gci
- gofumpt
settings:
gofumpt:
extra-rules: true
linters:
default: all
disable:
- cyclop # duplicate of gocyclo
- dupl
- err113
- exhaustive
- exhaustruct
- lll
- mnd
- nilnil
- nlreturn
- paralleltest
- prealloc
- rowserrcheck # not relevant (SQL)
- sqlclosecheck # not relevant (SQL)
- testpackage
- tparallel
- varnamelen
- wrapcheck
- wsl
settings:
depguard:
rules:
main:
deny:
- pkg: "github.com/instana/testify"
- pkg: github.com/instana/testify
desc: not allowed
- pkg: "github.com/pkg/errors"
- pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package
forbidigo:
forbid:
- pattern: ^print(ln)?$
- pattern: ^spew\.Print(f|ln)?$
- pattern: ^spew\.Dump$
funlen:
lines: -1
statements: 40
godox:
keywords:
- FIXME
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- sloppyReassign
- rangeValCopy
- octalLiteral
- paramTypeCombine # already handle by gofumpt.extra-rules
enabled-tags:
- diagnostic
- style
- performance
settings:
hugeParam:
sizeThreshold: 100
forbidigo:
forbid:
- '^print(ln)?$'
- '^spew\.Print(f|ln)?$'
- '^spew\.Dump$'
gocyclo:
min-complexity: 12
godox:
keywords:
- FIXME
gomoddirectives:
replace-allow-list:
- github.com/abbot/go-http-auth
@ -80,29 +80,29 @@ linters-settings:
- G204 # Subprocess launched with a potential tainted input or cmd arguments
- G301 # Expect directory permissions to be 0750 or less
- G306 # Expect WriteFile permissions to be 0600 or less
govet:
disable:
- fieldalignment
enable-all: true
misspell:
locale: US
issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude:
- 'ST1000: at least one file in a package should have a package comment'
- 'package-comments: should have a package comment'
exclude-rules:
- path: cmd/
linters:
exclusions:
presets:
- comments
rules:
- linters:
- gochecknoglobals
- gochecknoinits
- path: internal/traefikv[1-3]/
linters:
path: cmd/
- linters:
- tagalign
path: internal/traefikv[1-3]/
- path: (.+)\.go$
text: 'ST1000: at least one file in a package should have a package comment'
- path: (.+)\.go$
text: 'package-comments: should have a package comment'
output:
show-stats: true
sort-results: true
sort-order:
- linter
- file
run:
timeout: 5m
issues:
max-issues-per-linter: 0
max-same-issues: 0