-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Welcome
- Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've read the
typechecksection of the FAQ. - Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
- I agree to follow this project's Code of Conduct
How did you install golangci-lint?
Other
Description of the problem
Hello. We are updating our codebase to go1.25 and we can't make our CI using golangci-lint pre-commit hook happy.
We have this entry in our .pre-commit-config.yaml:
repos:
- repo: https://github.com/golangci/golangci-lint
rev: v2.5.0
hooks:
- id: golangci-lint
entry: bash -c 'cd backend && golangci-lint run --new-from-rev HEAD --fix'
files: ^go/.*\.go$
stages: [pre-commit]Locally, it works fine on my machine ™️ , but in our CI it errors out:
golangci-lint............................................................Failed
- hook id: golangci-lint
- exit code: 3
Error: can't load config: the Go language version (go1.24) used to build golangci-lint is lower than the targeted Go version (1.25.1)
The command is terminated due to an error: can't load config: the Go language version (go1.24) used to build golangci-lint is lower than the targeted Go version (1.25.1)
Our GitHub Action to run this check is simply:
name: Code linting
on:
pull_request:
push:
branches:
- main
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1Version of golangci-lint
On my machine:
$ golangci-lint --version
golangci-lint has version 2.5.0 built with go1.25.0 from v2.5.0 on 1970-01-01T00:00:00ZThis is not our CI env.
Configuration
# default settingsGo environment
Running commands on my machine, not our CI:
$ go version && go env
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/h/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/h/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3438129952=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/h/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/h/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nix/store/3fd683jfggglpshxprz9mi5sz8wd3c9p-go-1.25.0/share/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/h/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nix/store/3fd683jfggglpshxprz9mi5sz8wd3c9p-go-1.25.0/share/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.0'
GOWORK=''
PKG_CONFIG='pkg-config'Verbose output of running
I can run these just fine in my machine, no errors at all.
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output hereA minimal reproducible example or link to a public repository
package main
func main() {}Validation
- Yes, I've included all information above (version, config, etc.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective