feat(pre-commit-advisory): restore/seed Go caches for the golang hooks - #50
Merged
Conversation
The golang hooks are diff-*triggered* but whole-module in execution: golangci-lint typechecks the entire module and go-mod-tidy-repo re-resolves the full module graph, and the workflow cached neither the Go module/build caches nor golangci-lint's analysis cache — every PR run paid ~4 minutes cold (measured on chaos-lab: 42s tidy + 3m27s lint). PR runs now restore ~/go/pkg/mod, ~/.cache/go-build and ~/.cache/golangci-lint (restore-only, to avoid churning the 10GB cache budget with per-push saves), and the push-to-default-branch seed run executes the Go hooks and saves the caches per-sha, so PRs restore a warm cache at most one merge behind and only re-analyze what they touched. All three steps are gated on a go.sum existing — a no-op for non-Go callers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
golangci-linttypechecks the entire module andgo-mod-tidy-repore-resolves the full module graph, and the workflow cached nothing Go-related — every PR advisory run paid ~4 minutes cold (measured on chaos-lab run 30557635862: 42s tidy + 3m27s lint, everything else <1s).~/go/pkg/mod,~/.cache/go-build, and~/.cache/golangci-lint(restore-only, so per-push ~0.5–1GB saves don't churn the repo's 10GB cache budget).~/go/pkg/modalso covers the GOTOOLCHAIN auto-provisioned toolchain.go.sumexisting, and the warm step tolerates missing hook ids — additive no-op for every non-Go caller.Test plan
actionlintpasses locally on the edited workflow (done)go-hook-caches-*cache in the advisory job🤖 Generated with Claude Code