Skip to content

Golang version regression when running with pre-commit #4989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 of 7 tasks
DanGM96 opened this issue Sep 6, 2024 · 2 comments
Closed
5 of 7 tasks

Golang version regression when running with pre-commit #4989

DanGM96 opened this issue Sep 6, 2024 · 2 comments
Labels
question Further information is requested

Comments

@DanGM96
Copy link

DanGM96 commented Sep 6, 2024

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 typecheck section 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

Description of the problem

We updated our project's golang version to 1.23.0 recently, and with it, most of our pre-commits, specifically version 1.60.3, stopped working with go above 1.22

I say it's a regression because it works on both previous versions, 1.60.1 and 1.60.2.

I'm sorry I couldn't test on a standalone linter, but 1.60.2 will now suffice. I'm just reporting to help you guys.

Version of golangci-lint

I don't use golangci-lint directly, but the version used with pre-commit is:

  • v1.60.3

Configuration

.pre-commit-config.yaml

repos:
-   repo: https://github.com/golangci/golangci-lint
    rev: v1.60.3
    hooks:
    -   id: golangci-lint
        stages: [commit]

Go environment

$ go version && go env
go version go1.23.1 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/myuser/.cache/go-build'
GOENV='/home/myuser/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/myuser/go/pkg/mod'
GONOPROXY='github.com/myorganization'
GONOSUMDB='github.com/myorganization'
GOOS='linux'
GOPATH='/home/myuser/go'
GOPRIVATE='github.com/myorganization'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/myuser/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/home/myuser/myproject/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2009260257=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

pre-commit output:

golangci-lint............................................................Failed
- hook id: golangci-lint
- exit code: 3

Error: can't load config: the Go language version (go1.22) used to build golangci-lint is lower than the targeted Go version (1.23.0)
Failed executing command with error: can't load config: the Go language version (go1.22) used to build golangci-lint is lower than the targeted Go version (1.23.0)

A minimal reproducible example or link to a public repository

// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

@DanGM96 DanGM96 added the bug Something isn't working label Sep 6, 2024
Copy link

boring-cyborg bot commented Sep 6, 2024

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Sep 6, 2024
@ldez
Copy link
Member

ldez commented Sep 6, 2024

Hello,

Failed executing command with error: can't load config: the Go language version (go1.22) used to build golangci-lint is lower than the targeted Go version (1.23.0)

This is not related to the pre-commit and is not a regression but the expected behavior.

You are trying to use a golangci-lint binary compiled with go1.22 to analyze go1.23 code.
This cannot work, it's like if you are trying to compile go1.23 code with go1.22.

You should use a golangci-lint binary compiled with go1.23 to analyze go1.23 code.

I recommend using our pre-compiled binaries https://github.com/golangci/golangci-lint/releases/tag/v1.60.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants