Skip to content

Bug Report: Golang upgrade breaks golangci-lint #374

@lucky

Description

@lucky

Describe the bug

When upgrading from 1.25 to 1.26 and trying to use golangci-lint, the following error is received:

golangci-lint run ./...
Error: can't load config: the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26)
The command is terminated due to an error: can't load config: the Go language version (go1.25) used to build golangci-lint is lower than the targeted Go version (1.26)

To Reproduce

This requires that the go.mod for the project be updated to the latest version as well.

Expected behavior

No failure.

Workarounds

Install the linter manually. I do this with a step in CI:

          - run:
              name: Install Linter
              command: |
                mkdir ~/golangci-lint && cd ~/golangci-lint
                wget https://github.com/golangci/golangci-lint/releases/download/v2.9.0/golangci-lint-2.9.0-source.tar.gz
                echo 'c9db259fafca8f5312c0922ac4a499f06b864ee46f4b614b5962b1643dee36a2  golangci-lint-2.9.0-source.tar.gz' | sha256sum -c
                tar -xzf golangci-lint-2.9.0-source.tar.gz
                go install ./cmd/golangci-lint

Additional context

This happens because Dockerfile.template installs golangci-lint from a binary, and this binary is built by the golangci-lint project. Therefore this method is subject to the version the tool is built with upstream.

Modifying Dockerfile.template to download the build from source like above would solve this problem.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions