-
Welcome
How did you install golangci-lint?Official binary Description of the problemFor projects supporting Go <1.22 the
I'd like to still do the checks that Version of golangci-lint$ golangci-lint --version
golangci-lint has version 1.64.5 built with go1.24.0 from 0a603e49 on 2025-02-13T21:19:55Z Configuration---
run:
concurrency: 2
deadline: 5m
issues:
# include:
# - EXC0012
# - EXC0013
# - EXC0014
# - EXC0015
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0
# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0
new-from-rev: ""
linters:
disable-all: true
enable:
# Some linters have been removed because of the go 1.18 issues.
# https://github.com/golangci/golangci-lint/issues/2649
- asciicheck
- asciicheck
- contextcheck
# TODO: Uncomment after upgrading to Go >1.22
- copyloopvar
- depguard
- dogsled
- err113
- errcheck
- errorlint
- exhaustive
- exportloopref
- gci
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- makezero
- misspell
- nakedret
- nestif
- nolintlint
- paralleltest
- predeclared
- revive
- staticcheck
- stylecheck
- thelper [94/360]
- typecheck
- unconvert
- unused
- whitespace
- wrapcheck
linters-settings:
depguard:
rules:
main:
files:
- $all
- "!$test"
allow:
# Go standard library
- $gostd
# This project.
- "github.com/ianlewis/lexparse"
# Dependencies.
- "github.com/ianlewis/runeio"
deny:
- pkg: "reflect"
desc: Please don't use reflect package
- pkg: "unsafe"
desc: Please don't use unsafe package
test:
files:
- $test
allow:
# Go standard library
- $gostd
# This project.
- "github.com/ianlewis/lexparse"
# Dependencies.
- "github.com/ianlewis/runeio"
- "github.com/google/go-cmp/cmp"
deny:
- pkg: "reflect"
desc: Use go-cmp instead.
- pkg: "unsafe"
desc: Please don't use unsafe package
errcheck:
check-type-assertions: true
check-blank: true
gocognit:
# Minimal code complexity to report
# Increased beyond default to support table-driven tests and to preserve
# some semblance of sanity.
min-complexity: 40
nestif:
# Increased beyond default to preserve some semblance of sanity.
min-complexity: 8
govet:
disable:
# Too strict.
- fieldalignment
enable:
- shadow
godox:
keywords:
- BUG
- FIXME
- HACK
gci:
sections:
- standard
- default
- prefix(github.com/ianlewis/lexparse)
gocritic:
disable-all: true
enabled-checks:
# Diagnostic
- appendAssign
- argOrder
- badCond
- caseOrder
- codegenComment
- commentedOutCode
- deprecatedComment
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- exitAfterDefer
- flagDeref
- flagName
- nilValReturn
- offBy1
- sloppyReassign
- weakCond
- octalLiteral
# Performance
- appendCombine
- equalFold
- hugeParam
- indexAlloc
- rangeExprCopy
- rangeValCopy
# Style
- assignOp
- boolExprSimplify
- captLocal
- commentFormatting
- commentedOutImport
- defaultCaseOrder
- docStub
- elseif
- emptyFallthrough
- emptyStringTest
- hexLiteral
- ifElseChain
- methodExprCall
- regexpMust
- singleCaseSwitch
- sloppyLen
- stringXbytes
- switchTrue
- typeAssertChain
- typeSwitchVar
- underef
- unlabelStmt
- unlambda
- unslice
- valSwap
- wrapperFunc
- yodaStyleExpr
# Opinionated
- builtinShadow
- importShadow
- initClause
- nestingReduce
- paramTypeCombine
- ptrToRefParam
- typeUnparen
- unnecessaryBlock Go environment
```console
$ go version && go env
go version go1.24.0 linux/amd64
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/ian/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/ian/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3374355151=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/ian/src/lexparse/go.mod'
GOMODCACHE='/home/ian/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ian/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/ian/opt/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/ian/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='go1.24.0+auto'
GOTOOLDIR='/home/ian/opt/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'
```
Verbose output of running$ golangci-lint cache clean
$ golangci-lint run -v
INFO golangci-lint has version 1.64.5 built with go1.24.0 from 0a603e49 on 2025-02-13T21:19:55Z
INFO [config_reader] Config search paths: [./ /home/ian/src/lexparse /home/ian/src /home/ian /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [goenv] Read go env for 2.80704ms: map[string]string{"GOCACHE":"/home/ian/.cache/go-build", "GOROOT":"/home/ian/opt/go"}
WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
INFO [lintersdb] Active 44 linters: [asciicheck contextcheck copyloopvar depguard dogsled err113 errcheck errorlint exhaustive exportloopref gci gochecknoinits gocognit goconst gocritic gocyclo godot godox gofmt gofumpt goheader goimports gomodguard goprintffuncname gosec gosimple govet ineffassign lll makezero misspell nakedret nestif nolintlint paralleltest predeclared revive staticcheck stylecheck thelper unconvert unused whitespace wrapcheck]
INFO [loader] Go packages loading at mode 8767 (types_sizes|deps|files|name|compiled_files|exports_file|imports) took 139.410027ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 3.322737ms
WARN [linters_context] copyloopvar: this linter is disabled because the Go version (1.18) of your project is lower than Go 1.22
ERRO [linters_context] exportloopref: This linter is fully inactivated: it will not produce any reports.
INFO [linters_context/goanalysis] analyzers took 5.125756336s with top 10 stages: buildir: 1.969264733s, buildssa: 750.267035ms, the_only_name: 585.005981ms, exhaustive: 273.938433ms, unconvert: 155.204005ms, gocritic: 153.919953ms, goimports: 147.695006ms, gosec: 130.664612ms, inspect: 116.635117ms, ctrlflow: 60.251312ms
INFO [runner] Issues before processing: 6, after processing: 0
INFO [runner] Processors filtering stat (in/out): cgo: 6/6, filename_unadjuster: 6/6, skip_files: 6/6, skip_dirs: 6/6, generated_file_filter: 6/6, path_absoluter: 6/6, identifier_marker: 6/6, exclusion_rules: 6/6, path_relativity: 6/6, exclusion_paths: 6/6, nolint_filter: 6/0, invalid_issue: 6/6
INFO [runner] processing took 1.166375ms with stages: nolint_filter: 631.46µs, exclusion_rules: 481.699µs, generated_file_filter: 36.019µs, skip_dirs: 6.652µs, path_relativity: 3.144µs, invalid_issue: 1.299µs, identifier_marker: 956ns, cgo: 792ns, filename_unadjuster: 618ns, path_absoluter: 593ns, max_same_issues: 487ns, fixer: 350ns, uniq_by_line: 313ns, exclusion_paths: 310ns, diff: 257ns, sort_results: 236ns, skip_files: 234ns, max_from_linter: 211ns, source_code: 203ns, max_per_file_from_linter: 162ns, path_shortener: 158ns, path_prettifier: 141ns, severity-rules: 81ns
INFO [runner] linters took 3.031280057s with stages: goanalysis_metalinter: 3.030037348s, copyloopvar: 12.2µs, exportloopref: 8.879µs
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 33 samples, avg is 226.2MB, max is 322.0MB
INFO Execution took 3.180680408s A minimal reproducible example or link to a public repository// add your code here Validation
Supporter
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Beta Was this translation helpful? Give feedback.
-
Hello, Go 1.22 and lower are not supported by the Go team, we follow the same rules as the Go team. https://golangci-lint.run/welcome/faq/#which-go-versions-are-supported I recommend updating your Go version if you don't want to be exposed to security issues. |
Beta Was this translation helpful? Give feedback.
An alternative solution is to use plugins: https://golangci-lint.run/plugins/module-plugins/
But you will have to use another name than
exportloopref
when you register the plugin.I strongly recommend updating your Go version.