-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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?
Official binary
Description of the problem
On a system where the git command is Git v2.52.0 (which is the latest version as of this writing), golangci-lint custom -v fails with messaging like this:
INFO Cloning golangci-lint repository
INFO error: invalid key: advice.detachedHead
fatal: unable to write parameters to config file
Error: build process: clone golangci-lint: git clone --branch v2.1.1 --single-branch --depth 1 -c advice.detachedHead=false -q https://github.com/golangci/golangci-lint.git: exit status 128
Failed executing command with error: build process: clone golangci-lint: git clone --branch v2.1.1 --single-branch --depth 1 -c advice.detachedHead=false -q https://github.com/golangci/golangci-lint.git: exit status 128
The issue is that golangci-lint is passing -c advice.detachedHead=false as a single command-line argument with a space in it [code link], which means that the config key is advice.detachedHead with a leading space. (Older versions of Git silently strip out that leading space, but apparently Git v2.52.0 is stricter? Or at least, this is the case with the Git v2.52.0 installed via Homebrew on a Mac. I haven't tested with other systems, and I don't see any documentation about this change.)
This can be fixed either by passing -c and advice.detachedHead=false as two separate arguments, or to pass -cadvice.detachedHead=false as a single argument with no space. (In the latter case I'd suggest writing something like "-c"+"advice.detachedHead=false" for searchability of advice.detachedHead.)
Thanks in advance!
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 2.6.2 built with go1.25.3 from dc16cf43 on 2025-11-14T13:00:52ZConfiguration
# paste configuration file or CLI flags hereGo environment
$ go version && go env
# paste output hereVerbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output hereA minimal reproducible example or link to a public repository
// add your code hereValidation
- Yes, I've included all information above (version, config, etc.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective