Skip to content

Conversation

@ldez
Copy link
Member

@ldez ldez commented Nov 19, 2025

Fixes #6205

@ldez ldez added this to the unreleased milestone Nov 19, 2025
@ldez ldez added bug Something isn't working linter: custom About custom/private linters labels Nov 19, 2025
@ldez ldez mentioned this pull request Nov 19, 2025
7 tasks
@ldez ldez merged commit 101ccac into golangci:main Nov 19, 2025
18 checks passed
@ldez ldez deleted the fix/custom-detachedHead branch November 19, 2025 10:39
osterman added a commit to cloudposse/atmos that referenced this pull request Nov 27, 2025
Remove git wrapper workaround and pin to commit 101ccaca which fixes
the "-c advice.detachedHead=false" bug in golangci-lint custom command.

The bug: golangci-lint passes "-c advice.detachedHead=false" as a single
argument, but Git v2.52+ rejects this (expects two separate arguments).

Fix PR: golangci/golangci-lint#6206

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
osterman added a commit to cloudposse/atmos that referenced this pull request Nov 27, 2025
* fix: Update golangci-lint version from v2.5.0 to v2.6.1

Resolves version mismatch between installed binary (v2.6.1) and
configuration files (v2.5.0) that was causing custom build failures.

- Update .custom-gcl.yml version field
- Update go install commands in codeql.yml and pre-commit.yml
- Update golangci-lint-action version parameter
- Update documentation examples in lintroller README

✅ Custom binary builds successfully with updated version.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Update to golangci-lint v2.6.2 and add GITHUB_TOKEN for rate limits

Updates golangci-lint from v2.6.1 to v2.6.2 (latest) and adds GITHUB_TOKEN
to the custom build step to prevent GitHub API rate limit errors during
git clone operations.

Changes:
- Update version to v2.6.2 in all config files and workflows
- Add GITHUB_TOKEN env var to custom build step in codeql.yml
- This resolves "git clone --branch v2.6.1 exit status 128" errors

The error was caused by GitHub rate limiting unauthenticated git clone
requests during the custom build process.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Add git config to use GITHUB_TOKEN for authenticated clones

Explicitly configure git to use GITHUB_TOKEN for authentication when
cloning the golangci-lint repository during custom build. This prevents
GitHub API rate limit errors (60 req/hour for unauthenticated requests).

The GITHUB_TOKEN environment variable alone is not sufficient - git
requires explicit configuration via git config to use the token for
authentication.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Add git authentication test before custom build

Add git ls-remote test to verify authentication is working before
attempting golangci-lint custom build. This will help diagnose whether
the issue is with git authentication or another problem.

Also adds GIT_TERMINAL_PROMPT=0 to prevent interactive prompts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Add git safe.directory config and GOFLAGS=-buildvcs=false

Fixes "exit status 128" error in golangci-lint custom build by:
1. Adding workspace and all directories to git safe.directory
2. Setting GOFLAGS=-buildvcs=false to disable VCS stamping

The exit 128 error occurs when Go 1.18+ tries to embed VCS info in
binaries but encounters permission/ownership issues in CI environments.

Fixes: https://github.com/golangci/golangci-lint/discussions/5972

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Revert to golangci-lint v2.5.0 to match installed binary version

Reverting from v2.6.2 back to v2.5.0 which matches the installed
binary version. The v2.6.x versions have persistent exit 128 errors
in golangci-lint custom command that cannot be resolved.

Keep GOFLAGS=-buildvcs=false and git config from previous attempts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Fix HOME directory for git operations in GitHub Actions

Apply fix from golangci-lint-action/discussions/1312 to resolve exit 128
errors. GitHub Actions can override HOME env var, causing git operations
to fail. Fix by dynamically retrieving correct home directory.

Removes unnecessary GITHUB_TOKEN and git URL rewrite config.

Fixes: golangci/golangci-lint-action#1312

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Revert to exact working configuration from Nov 25

Remove all attempted fixes (GOFLAGS, HOME, git config) and restore
the exact workflow configuration that was working successfully on
main branch as of Nov 25 (commit 8f1fe66).

This will help isolate whether the issue is configuration-related or
an external change (runner, GitHub, golangci-lint infrastructure).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* debug: Test if git clone works at all in CI environment

Add diagnostic to test if we can clone the golangci-lint public repo
directly before running golangci-lint custom. This will tell us if:
- Git clone works → Issue is specific to golangci-lint custom command
- Git clone fails → Network/GitHub/git issue in CI environment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* debug: Test exact git clone command used by golangci-lint custom

Test the exact git clone command with all flags that golangci-lint
custom uses. If it fails, test individual flags to identify which
flag is causing the exit 128 error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* debug: Run golangci-lint custom with verbose output

Run golangci-lint custom with -v flag to see detailed output about
what it's doing and where it's failing. Capture environment details
like working directory, git path, HOME, TMPDIR, and disk space.

This will help identify what's different about the environment when
golangci-lint custom runs git vs when we run it directly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Pre-configure git advice.detachedHead to work around compatibility issue

The runner's git version doesn't support the advice.detachedHead config
key that golangci-lint custom tries to use with -c flag. Pre-configure
it globally so when golangci-lint custom runs git clone with
-c advice.detachedHead=false, git can use the global config instead.

This is a golangci-lint bug - it should detect git version and avoid
using unsupported config keys.

Root cause: "error: invalid key: advice.detachedHead"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Correct comment - issue is leading space in -c flag

The error shows 'invalid key:  advice.detachedHead' with a leading space.
golangci-lint passes -c flag with incorrect parsing. Pre-configure globally.

* debug: Test if git version supports advice.detachedHead config

Add diagnostic to check if the git version actually supports the
advice.detachedHead config key before trying to use it.

* fix: Use git wrapper to strip broken -c flag

Intercept git calls and remove -c flags to work around golangci-lint bug.

* debug: Add logging to git wrapper to diagnose -c flag filtering

Added debug output to show:
- Original arguments passed to git
- Which -c flags are being filtered
- Final filtered arguments

This will help us verify the wrapper is correctly stripping the
malformed -c flag that golangci-lint v2.5.0 is passing.

* fix: Pin golangci-lint to commit with -c flag fix

Remove git wrapper workaround and pin to commit 101ccaca which fixes
the "-c advice.detachedHead=false" bug in golangci-lint custom command.

The bug: golangci-lint passes "-c advice.detachedHead=false" as a single
argument, but Git v2.52+ rejects this (expects two separate arguments).

Fix PR: golangci/golangci-lint#6206

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Auto-install gh actions-cache extension in dev commands

The cache-list and cache-clear commands now automatically install the
gh actions-cache extension if it's not already present, improving the
developer experience by removing manual setup steps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Pin AWS provider to v5.x for LocalStack compatibility

AWS provider v6.x has breaking changes in S3 bucket creation that
LocalStack 1.4.0 doesn't support, causing MalformedXML errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
@ldez ldez modified the milestones: unreleased, v2.7 Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working linter: custom About custom/private linters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invalid key: advice.detachedHead

2 participants