-
Welcome
Description of the problemWe have a .golangci-lint.yml in the root of the repo. We haven't change golangci-lint version in 6 months and out of nowhere it's applying new rules. I updated the config in a new branch and the workflow still applies the same rules. Failing workflows can be seen here: https://github.com/gofiber/fiber/actions/workflows/linter.yml I created a new PR with updated config to ignore the issues and even though it works locally it fails on the CI while ignoring by config. Trying to fix issues in this PR: gofiber/fiber#3354 Version of golangci-lint1.64.7 Version of the GitHub Actionlatest Workflow filename: golangci-lint
on:
push:
branches:
- master
- main
paths-ignore:
- "**/*.md"
pull_request:
paths-ignore:
- "**/*.md"
permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
checks: write
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
# NOTE: Keep this in sync with the version from go.mod
go-version: "1.23.x"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# NOTE: Keep this in sync with the version from .golangci.yml
version: v1.62.2
Golangci-lint configurationrun:
timeout: 5m
modules-download-mode: readonly
allow-serial-runners: true
output:
sort-results: true
uniq-by-line: false
linters-settings:
depguard:
rules:
all:
list-mode: lax
deny:
- pkg: "flag"
desc: '`flag` package is only allowed in main.go'
- pkg: "log"
desc: 'logging is provided by `pkg/log`'
- pkg: "io/ioutil"
desc: '`io/ioutil` package is deprecated, use the `io` and `os` package instead'
# TODO: Prevent using these without a reason
# - pkg: "reflect"
# desc: '`reflect` package is dangerous to use'
# - pkg: "unsafe"
# desc: '`unsafe` package is dangerous to use'
errcheck:
check-type-assertions: true
check-blank: true
disable-default-exclusions: true
exclude-functions:
- '(*bytes.Buffer).Write' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).Write' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).WriteByte' # always returns nil error
- '(*github.com/valyala/bytebufferpool.ByteBuffer).WriteString' # always returns nil error
errchkjson:
report-no-exported: true
exhaustive:
check-generated: true
default-signifies-exhaustive: true
forbidigo:
forbid:
- ^print(ln)?$
- ^fmt\.Print(f|ln)?$
- ^http\.Default(Client|ServeMux|Transport)$
# TODO: Eventually enable these patterns
# - ^panic$
# - ^time\.Sleep$
analyze-types: true
gci:
sections:
- standard
- prefix(github.com/gofiber/fiber)
- default
- blank
- dot
# - alias
custom-order: true
goconst:
numbers: true
gocritic:
# TODO: Uncomment the following lines
enabled-tags:
- diagnostic
# - style
# - performance
# - experimental
# - opinionated
settings:
captLocal:
paramsOnly: false
elseif:
skipBalanced: false
underef:
skipRecvDeref: false
# NOTE: Set this option to false if other projects rely on this project's code
# unnamedResult:
# checkExported: false
gofumpt:
module-path: github.com/gofiber/fiber
extra-rules: true
gosec:
excludes:
- G104 # TODO: Enable this again. Mostly provided by errcheck
config:
global:
# show-ignored: true # TODO: Enable this
audit: true
govet:
enable-all: true
disable:
- shadow
grouper:
# const-require-grouping: true # TODO: Enable this
import-require-single-import: true
import-require-grouping: true
# var-require-grouping: true # TODO: Conflicts with gofumpt
loggercheck:
require-string-key: true
no-printf-like: true
misspell:
locale: US
nolintlint:
require-explanation: true
require-specific: true
nonamedreturns:
report-error-in-defer: true
perfsprint:
err-error: true
predeclared:
q: true
promlinter:
strict: true
# TODO: Enable this
# reassign:
# patterns:
# - '.*'
revive:
enable-all-rules: true
rules:
# Provided by gomnd linter
- name: add-constant
disabled: true
- name: argument-limit
disabled: true
# Provided by bidichk
- name: banned-characters
disabled: true
- name: cognitive-complexity
disabled: true
- name: comment-spacings
arguments:
- nolint
disabled: true # TODO: Do not disable
- name: cyclomatic
disabled: true
# TODO: Enable this check. Currently disabled due to upstream bug.
# - name: enforce-repeated-arg-type-style
# arguments:
# - short
- name: enforce-slice-style
arguments:
- make
disabled: true # TODO: Do not disable
- name: exported
disabled: true
- name: file-header
disabled: true
- name: function-result-limit
arguments: [3]
- name: function-length
disabled: true
- name: line-length-limit
disabled: true
- name: max-public-structs
disabled: true
- name: modifies-parameter
disabled: true
- name: nested-structs
disabled: true # TODO: Do not disable
- name: package-comments
disabled: true
- name: optimize-operands-order
disabled: true
- name: unchecked-type-assertion
disabled: true # TODO: Do not disable
- name: unhandled-error
arguments: ['bytes\.Buffer\.Write']
stylecheck:
checks:
- all
- -ST1000
- -ST1020
- -ST1021
- -ST1022
tagalign:
strict: true
tagliatelle:
case:
rules:
json: snake
tenv:
all: true
testifylint:
enable-all: true
testpackage:
skip-regexp: "^$"
unparam:
# NOTE: Set this option to false if other projects rely on this project's code
check-exported: false
unused:
# TODO: Uncomment these two lines
# parameters-are-used: false
# local-variables-are-used: false
# NOTE: Set these options to true if other projects rely on this project's code
field-writes-are-uses: true
# exported-is-used: true # TODO: Fix issues with this option (upstream)
exported-fields-are-used: true
usestdlibvars:
http-method: true
http-status-code: true
time-weekday: false # TODO: Set to true
time-month: false # TODO: Set to true
time-layout: false # TODO: Set to true
crypto-hash: true
default-rpc-path: true
sql-isolation-level: true
tls-signature-scheme: true
constant-kind: true
wrapcheck:
ignorePackageGlobs:
- github.com/gofiber/fiber/*
- github.com/valyala/fasthttp
issues:
exclude-use-default: false
exclude-case-sensitive: true
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs:
- internal # TODO: Do not ignore interal packages
exclude-rules:
- linters:
- err113
text: 'do not define dynamic errors, use wrapped static errors instead*'
- path: log/.*\.go
linters:
- depguard
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- bodyclose
- err113
# fix: true
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
# - cyclop
- decorder
- depguard
- dogsled
# - dupl
- dupword # TODO: Enable
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
# - exhaustivestruct
# - exhaustruct
- copyloopvar
- forbidigo
- forcetypeassert
# - funlen
# - gci # TODO: Enable
- ginkgolinter
# - gocheckcompilerdirectives # TODO: Enable
# - gochecknoglobals # TODO: Enable
# - gochecknoinits # TODO: Enable
- gochecksumtype
# - gocognit
- goconst # TODO: Enable
- gocritic
# - gocyclo
# - godot
# - godox
- err113
- gofmt
- gofumpt
# - goheader
- goimports
# - mnd # TODO: Enable
- gomoddirectives
# - gomodguard
- goprintffuncname
- gosec
- gosimple
# - gosmopolitan # TODO: Enable
- govet
- grouper
# - ifshort # TODO: Enable
# - importas
# - inamedparam
- ineffassign
# - interfacebloat
# - interfacer
# - ireturn
# - lll
- loggercheck
# - maintidx
- makezero
# - maligned
- mirror
- misspell
- musttag
- nakedret
# - nestif
- nilerr
- nilnil
# - nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
# - paralleltest # TODO: Enable
- perfsprint
# - prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
# - scopelint # TODO: Enable
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- stylecheck
# - tagalign # TODO: Enable
- tagliatelle
- tenv
- testableexamples
- testifylint
# - testpackage # TODO: Enable
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# - varnamelen
# - wastedassign # TODO: Enable
- whitespace
- wrapcheck
# - wsl
- zerologlint Go version1.23.x Code example or link to a public repositoryn/a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 22 replies
-
We are stuck unable to run any CI workflows because of this. Running locally returns 0 errors. Running on the workflow returns over +10 errors |
Beta Was this translation helpful? Give feedback.
I will open a dedicated issue: golangci/golangci-lint#5580