fix(#2060): set up Go on runner before post-code pre-commit#2213
Conversation
When a target repo's go.mod declares a Go version newer than the golangci-lint binary installed by pre-commit's language: golang mechanism, golangci-lint exits with code 3 before analyzing any code — blocking PR creation. Add a conditional actions/setup-go step in action.yml that runs before fullsend (and therefore before post-code.sh's authoritative pre-commit gate). The step reads the target repo's go.mod via go-version-file and installs the matching toolchain on the runner. pre-commit then uses that toolchain when building golangci-lint, satisfying the version requirement. The step is skipped entirely for non-Go repos (hashFiles guard), so there is no latency impact on other runs. cache: false avoids polluting the runner's module cache with the target repo's dependencies. Signed-off-by: Hector Martinez <hemartin@redhat.com>
Site previewPreview: https://1f140caf-site.fullsend-ai.workers.dev Commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🤖 Finished Review · ✅ Success · Started 9:43 AM UTC · Completed 9:53 AM UTC |
ReviewFindingsMedium
Low
|
|
🤖 Finished Retro · ✅ Success · Started 6:26 AM UTC · Completed 6:33 AM UTC |
Retro: PR #2213 —
|
The Go setup step added in PR fullsend-ai#2213 hardcoded 'target-repo' in both the hashFiles condition and the go-version-file parameter. When inputs.target-repo is overridden to a custom path, hashFiles('target-repo/go.mod') returns empty, the if condition is false, and the step is silently skipped — defeating the purpose of the Go setup for non-default checkout paths. Apply the same fallback pattern used in the Run fullsend step: - hashFiles: use format() with inputs.target-repo fallback - go-version-file: use expression with fallback to default Note: pre-commit could not run (shellcheck hook failed to install due to network restrictions in sandbox). The post-script will run pre-commit authoritatively. Closes fullsend-ai#2281
Summary
Fixes #2060.
When a target repo's
go.moddeclares a Go version newer than the golangci-lint binary installed by pre-commit'slanguage: golangmechanism, golangci-lint exits with code 3 before analyzing any code — blocking PR creation with:Change
Add a conditional
actions/setup-go@v6step inaction.ymlthat runs beforefullsend run(and therefore beforepost-code.sh's authoritative pre-commit gate). The step reads the target repo'sgo.modviago-version-fileand installs the matching Go toolchain on the runner. pre-commit then uses that toolchain when building golangci-lint from source, satisfying the version requirement.Non-Go repos: the
hashFilesguard skips the step entirely — no latency impact.cache: false: avoids polluting the runner's module cache with the target repo's dependencies.Relation to prior fixes
post-code.sh, which runs after the sandbox is destroyed.action.yml, which all code agent runs invoke.