Skip to content

feat(go-runner): keep GOCACHE and GOMODCACHE when they're set - #71

Open
marten-seemann wants to merge 1 commit into
CodSpeedHQ:mainfrom
marten-seemann:respect-gocache
Open

marten-seemann wants to merge 1 commit into
CodSpeedHQ:mainfrom
marten-seemann:respect-gocache

Conversation

@marten-seemann

Copy link
Copy Markdown

Each run builds from an empty build cache, and CI has no way to change that. On the Gen 1 macro runner, the cold build is 54 s of a 76 s benchmark step for a single package (quic-go's integrationtests/self), all of it billed. With this change, a workflow can set GOCACHE and restore it with actions/cache. Without them set, nothing changes.

The isolation was added in 4d1e0d3 to avoid conflicts between concurrent runs. Go's build cache is safe for concurrent use, and go test never caches results when -bench is set, so a shared cache can't cause benchmarks to be skipped.

Build-only times for ./integrationtests/self ./quicvarint on an M3 Max: 12.6 s with isolated caches, 7.4 s with a warm GOCACHE.

The testing package and every test binary are still rebuilt on each run, because the instrument-hooks dir and the profile dir are substituted into the overlay. With both paths fixed, the warm build takes 1.6 s. Reading them at runtime instead is left for a separate PR.

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5 · The PR appears safe to merge, with a non-blocking request for cache regression tests.RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects cache reuse for Go benchmark runs that use this runner.

The PR appears safe to merge, with a non-blocking request for cache regression tests.

FindingsFix All in Claude CodeFindings

  1. P2 Cache choices lack tests ▶
Fix with agent prompt
### Issue 1
go-runner/src/runner/mod.rs:71-75
The existing tests check benchmark results but never check `GOCACHE` or `GOMODCACHE`. Restoring the old unconditional overrides would therefore pass unnoticed and silently bring back cold builds in CI.

Add tests for nonempty, unset, and empty values, including cases where only one variable is set. Run each case in a child process so parallel tests do not share environment changes.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The runner now keeps nonempty GOCACHE and GOMODCACHE values.

  • Go benchmark runs can reuse cache paths set in the environment.

Reviews (1) · Last reviewed commit: "feat(go-runner): keep GOCACHE and GOMODC..." · Reviewed by Greptile

Comment on lines +71 to +75
for (var, cache_dir) in [("GOCACHE", "gocache"), ("GOMODCACHE", "gomodcache")] {
if std::env::var_os(var).is_none_or(|v| v.is_empty()) {
cmd.env(var, _dir.path().join(cache_dir));
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Cache choices lack tests

The existing tests check benchmark results but never check GOCACHE or GOMODCACHE. Restoring the old unconditional overrides would therefore pass unnoticed and silently bring back cold builds in CI.

Add tests for nonempty, unset, and empty values, including cases where only one variable is set. Run each case in a child process so parallel tests do not share environment changes.

Prompt To Fix With AI
This is a comment left during a code review.
Path: go-runner/src/runner/mod.rs
Line: 71-75

Comment:
**Cache choices lack tests**

The existing tests check benchmark results but never check `GOCACHE` or `GOMODCACHE`. Restoring the old unconditional overrides would therefore pass unnoticed and silently bring back cold builds in CI.

Add tests for nonempty, unset, and empty values, including cases where only one variable is set. Run each case in a child process so parallel tests do not share environment changes.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant