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: on:
push: push:
branches: branches:
- master
- main - main
pull_request: pull_request:
branches: branches:
- master
- main - main
jobs: jobs:

View File

@ -3,11 +3,9 @@ name: Main
on: on:
push: push:
branches: branches:
- master
- main - main
pull_request: pull_request:
branches: branches:
- master
- main - main
jobs: jobs:
@ -17,7 +15,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GO_VERSION: stable GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.64.6 GOLANGCI_LINT_VERSION: v2.0.1
CGO_ENABLED: 0 CGO_ENABLED: 0
steps: steps:
@ -36,7 +34,7 @@ jobs:
# https://golangci-lint.run/usage/install#other-ci # https://golangci-lint.run/usage/install#other-ci
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} - name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: | 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 golangci-lint --version
- name: Make - name: Make

View File

@ -1,72 +1,72 @@
linters: version: "2"
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
linters-settings: formatters:
govet: enable:
enable-all: true - gci
disable: - gofumpt
- fieldalignment settings:
gocyclo:
min-complexity: 12
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: US
gofumpt: gofumpt:
extra-rules: true 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: depguard:
rules: rules:
main: main:
deny: deny:
- pkg: "github.com/instana/testify" - pkg: github.com/instana/testify
desc: not allowed desc: not allowed
- pkg: "github.com/pkg/errors" - pkg: github.com/pkg/errors
desc: Should be replaced by standard lib errors package desc: Should be replaced by standard lib errors package
forbidigo:
forbid:
- pattern: ^print(ln)?$
- pattern: ^spew\.Print(f|ln)?$
- pattern: ^spew\.Dump$
funlen: funlen:
lines: -1 lines: -1
statements: 40 statements: 40
godox: goconst:
keywords: min-len: 3
- FIXME min-occurrences: 3
gocritic: gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks: disabled-checks:
- sloppyReassign - sloppyReassign
- rangeValCopy - rangeValCopy
- octalLiteral - octalLiteral
- paramTypeCombine # already handle by gofumpt.extra-rules - paramTypeCombine # already handle by gofumpt.extra-rules
enabled-tags:
- diagnostic
- style
- performance
settings: settings:
hugeParam: hugeParam:
sizeThreshold: 100 sizeThreshold: 100
forbidigo: gocyclo:
forbid: min-complexity: 12
- '^print(ln)?$' godox:
- '^spew\.Print(f|ln)?$' keywords:
- '^spew\.Dump$' - FIXME
gomoddirectives: gomoddirectives:
replace-allow-list: replace-allow-list:
- github.com/abbot/go-http-auth - github.com/abbot/go-http-auth
@ -80,29 +80,29 @@ linters-settings:
- G204 # Subprocess launched with a potential tainted input or cmd arguments - G204 # Subprocess launched with a potential tainted input or cmd arguments
- G301 # Expect directory permissions to be 0750 or less - G301 # Expect directory permissions to be 0750 or less
- G306 # Expect WriteFile permissions to be 0600 or less - G306 # Expect WriteFile permissions to be 0600 or less
govet:
disable:
- fieldalignment
enable-all: true
misspell:
locale: US
issues: exclusions:
exclude-use-default: false presets:
max-issues-per-linter: 0 - comments
max-same-issues: 0 rules:
exclude: - linters:
- '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:
- gochecknoglobals - gochecknoglobals
- gochecknoinits - gochecknoinits
- path: internal/traefikv[1-3]/ path: cmd/
linters: - linters:
- tagalign - 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: issues:
show-stats: true max-issues-per-linter: 0
sort-results: true max-same-issues: 0
sort-order:
- linter
- file
run:
timeout: 5m