fix: Pin golangci-lint to commit with -c flag fix for Git v2.52+#1815
fix: Pin golangci-lint to commit with -c flag fix for Git v2.52+#1815
Conversation
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>
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
📝 WalkthroughWalkthroughIntroduces a git-wrapper workaround in Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CI as GitHub Actions Runner
participant FS as /usr/bin
participant Build as golangci-lint build step
Note over CI,Build: Pre-build: install git-wrapper
CI->>FS: mv /usr/bin/git -> /usr/bin/git.real (backup)
CI->>FS: write /usr/bin/git (wrapper script)
Note over FS: wrapper: log args -> strip `-c` flags -> exec /usr/bin/git.real
CI->>Build: run "Build custom golangci-lint" (invokes `git`)
Build->>FS: call /usr/bin/git (wrapper)
FS->>FS: wrapper strips `-c` args, forwards to /usr/bin/git.real
FS->>Build: git responds
Note over CI,Build: Post-build: optional restore/validation of original git
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1815 +/- ##
==========================================
- Coverage 71.98% 71.97% -0.02%
==========================================
Files 471 471
Lines 45222 45222
==========================================
- Hits 32554 32549 -5
- Misses 10070 10078 +8
+ Partials 2598 2595 -3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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>
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>
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>
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>
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>
6c289f3 to
47f216b
Compare
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>
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>
|
This pull request was automatically closed as it no longer contains any changes. This typically happens when another merged pull request has already included this request's |
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>
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
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>
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>
…ty 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>
The error shows 'invalid key: advice.detachedHead' with a leading space. golangci-lint passes -c flag with incorrect parsing. Pre-configure globally.
Add diagnostic to check if the git version actually supports the advice.detachedHead config key before trying to use it.
Intercept git calls and remove -c flags to work around golangci-lint bug.
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.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/codeql.yml (1)
136-136: Consider permission and portability implications of modifying/usr/bin/git.The wrapper uses
sudoto modify the system git binary. This approach works in the CI environment but is fragile and could break if runner permissions or setup change. If the root cause (the malformed-cflag) is fixed in v2.6.2, this complexity can be removed entirely.Also applies to: 165-165
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/codeql.yml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.github/workflows/*.{yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Configure CI to run unit tests, integration tests, golangci-lint, and coverage reporting on all pull requests
Files:
.github/workflows/codeql.yml
🧠 Learnings (7)
📓 Common learnings
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to .github/workflows/*.{yml,yaml} : Configure CI to run unit tests, integration tests, golangci-lint, and coverage reporting on all pull requests
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : All code must pass golangci-lint checks
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Follow standard Go coding style: use `gofmt` and `goimports` to format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to .github/workflows/*.{yml,yaml} : Configure CI to run unit tests, integration tests, golangci-lint, and coverage reporting on all pull requests
Applied to files:
.github/workflows/codeql.yml
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : All code must pass golangci-lint checks
Applied to files:
.github/workflows/codeql.yml
📚 Learning: 2025-03-25T12:23:42.649Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: internal/exec/go_getter_utils.go:104-104
Timestamp: 2025-03-25T12:23:42.649Z
Learning: Listener430 plans to add a test for verifying that token injection is skipped for unsupported hosts in a future review or refactoring iteration. This relates to the CustomGitDetector.Detect method in internal/exec/go_getter_utils.go.
Applied to files:
.github/workflows/codeql.yml
📚 Learning: 2024-11-18T13:59:10.824Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_model_component.go:3-20
Timestamp: 2024-11-18T13:59:10.824Z
Learning: When replacing significant dependencies like `go-getter` that require extensive changes, prefer to address them in separate PRs.
Applied to files:
.github/workflows/codeql.yml
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
.github/workflows/codeql.yml
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Ensure all tests pass, verify code coverage meets targets, run golangci-lint and fix any issues, and update documentation before submitting pull requests
Applied to files:
.github/workflows/codeql.yml
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (3)
.github/workflows/codeql.yml (3)
124-183: Verify that GITHUB_TOKEN environment variable is configured.Per the PR objectives, a GITHUB_TOKEN should be added to prevent GitHub API rate limit errors during the custom binary build. The git wrapper workaround (lines 127–174) addresses a symptom, but the stated fix requires setting the GITHUB_TOKEN env var. Confirm this is configured on the step or job level.
127-174: Git wrapper is a workaround; evaluate whether the root cause is resolved in v2.6.2.The wrapper strips
-cflags to work around a malformed git config flag issue in golangci-lint v2.5.0. Since the PR claims to update to v2.6.2, verify whether this issue is fixed upstream. If v2.6.2 resolves the-cflag problem, this entire wrapper block may be unnecessary and should be removed to keep CI logic clean.
110-110: I'll verify the concerns raised in this review comment by examining the workflow file and checking the actual state of the code.
<function_calls>
#!/bin/bashFirst, check the file size and read the relevant sections of the codeql.yml file
wc -l .github/workflows/codeql.yml
</function_calls>I'll now read the workflow file to verify the version strings and check for GITHUB_TOKEN:
<function_calls>
#!/bin/bashRead the full codeql.yml file to examine version strings and GITHUB_TOKEN
cat -n .github/workflows/codeql.yml
</function_calls>Let me search for all golangci-lint version references and GITHUB_TOKEN usage:
<function_calls>
#!/bin/bashSearch for golangci-lint version references
echo "=== golangci-lint version references ==="
rg -n "golangci-lint" .github/workflows/codeql.yml
echo ""
echo "=== GITHUB_TOKEN references ==="
rg -n "GITHUB_TOKEN" .github/workflows/codeql.yml
echo ""
echo "=== env: section ==="
rg -n -A5 "^[[:space:]]*env:" .github/workflows/codeql.yml
</function_calls>Now let me check the PR context and look for any version-related changes or objectives:
<function_calls>
#!/bin/bashCheck recent git history for this file
echo "=== Recent commits for codeql.yml ==="
git log --oneline -10 .github/workflows/codeql.yml 2>/dev/null || echo "Git history not available"
echo ""Check for v2.6.2 references anywhere in the repo
echo "=== All v2.6.2 references in the repo ==="
rg -n "v2.6.2" . 2>/dev/null | head -20
echo ""Check for current golangci-lint version in use
echo "=== All golangci-lint version references ==="
I need to see the results of these shell commands to verify the version strings and GITHUB_TOKEN presence. Let me wait for the execution results.
rg -n "golangci-lint.*@v2." . 2>/dev/null | head -20
</function_calls>I need to see the actual content to verify the issues. Let me try a more direct approach:
<function_calls>
#!/bin/bashExtract lines around 110 and 236 to verify version strings
echo "=== Lines 100-120 (around line 110) ==="
sed -n '100,120p' .github/workflows/codeql.yml
echo ""
echo "=== Lines 225-245 (around line 236) ==="
sed -n '225,245p' .github/workflows/codeql.yml
</function_calls>
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>
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>
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>
Brings in recent changes from main including: - Deferred YAML function evaluation in merge (#1821) - Website changelog redesign with vertical timeline (#1818) - Version management documentation improvements (#1817) - PR size labeler workflow (#1816) - golangci-lint pinning for Git v2.52+ compatibility (#1815) No conflicts detected - clean merge. Note: Pre-existing linting issues in init/scaffold experimental code remain and will be addressed separately before merging to main. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
what
101ccacawhich fixes the-c advice.detachedHead=falsebugwhy
golangci-lint fix
The
golangci-lint customcommand was failing with exit status 128 on CI runners using Git v2.52+.Root cause: golangci-lint passes
"-c advice.detachedHead=false"as a single argument, but Git v2.52+ became stricter and rejects this (expects two separate arguments:"-c"and"advice.detachedHead=false").Fix: PR #6206 was merged Nov 19, 2025 but not yet released. We pin to the fix commit until v2.6.3+ is released.
LocalStack fix
The LocalStack CI job was failing with
MalformedXMLerror when creating S3 buckets.Root cause: AWS Terraform provider v6.x has breaking changes in S3 bucket creation that LocalStack 1.4.0 does not support. The
providers.tfhad no version constraints, so Terraform installed v6.23.0.Fix: Pin AWS provider to
~> 5.0inexamples/demo-localstack/components/terraform/bucket/providers.tf.references