What happened
When running make lint or executing the testing suite locally under modern versions of Golang (Go 1.25+), the golangci-lint runner abruptly fails due to two independent issues:
-
Viper configuration unmarshal failure
- The
.golangci.yml contains an invalid top-level field:
- Viper strictly expects structured maps/dictionaries and fails while unmarshaling this field.
- This causes the following error:
ERRO Can't read config: can't unmarshal config by viper: 1 error(s) decoding:
* 'Version' expected a map, got 'string'
-
AST parsing panic from outdated Go linter logic
- After bypassing the config issue, the pinned
golangci-lint@v1.51.2 binary still crashes.
- The crash occurs because its AST engine is incompatible with modern Go compiler releases.
- Panic source:
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.analyzeRecursive...
What you expected to happen
Running make lint should correctly download a stable, compatible version of golangci-lint and statically inspect the codebase without abruptly crashing due to:
- internal Viper configuration parsing failures
- AST parsing panics on modern Go releases
How to reproduce the bug
- Ensure your local Go environment is Go 1.25.x or higher
- Clone the repository:
git clone https://github.com/openkruise/kruise.git
cd kruise
- Run:
How to fix
1) Fix .golangci.yml
Remove the invalid field at the top of the file:
2) Update Makefile
Bump the GOLANGCI_LINT binary target on line 133 from:
to a stable compatible release such as:
Environment details
- OS: Mac / Linux
- Go Version: 1.25.6
What happened
When running
make lintor executing the testing suite locally under modern versions of Golang (Go 1.25+), thegolangci-lintrunner abruptly fails due to two independent issues:Viper configuration unmarshal failure
.golangci.ymlcontains an invalid top-level field:AST parsing panic from outdated Go linter logic
golangci-lint@v1.51.2binary still crashes.What you expected to happen
Running
make lintshould correctly download a stable, compatible version ofgolangci-lintand statically inspect the codebase without abruptly crashing due to:How to reproduce the bug
git clone https://github.com/openkruise/kruise.git cd kruiseHow to fix
1) Fix
.golangci.ymlRemove the invalid field at the top of the file:
2) Update
MakefileBump the
GOLANGCI_LINTbinary target on line 133 from:to a stable compatible release such as:
Environment details