Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ Tests in `go-runner/src/integration_tests.rs` use real Go projects from `go-runn
- `CODSPEED_RUNNER_MODE` — `walltime` (default), `simulation`, or `memory`
- `CODSPEED_PROFILE_FOLDER` — where results are written (default: `/tmp`)
- `CODSPEED_LOG` — log level filter (default: `info`)
- `GOCACHE`, `GOMODCACHE` — used as is when set (default: fresh temp dirs per run)

## Gotchas

- `instrument-hooks.go` requires cgo (`import "C"`). The runner sets `CGO_ENABLED=1` and checks for a C compiler before building. Without this, Go silently excludes the file causing "undefined: InstrumentHooks" errors.
- The runner uses `$GOROOT/bin/go` directly (not PATH) to avoid infinite recursion with the runner binary intercepting `go test`.
- The runner sets custom `GOCACHE` and `GOMODCACHE` to temp dirs to avoid cache conflicts.
- The runner sets custom `GOCACHE` and `GOMODCACHE` to temp dirs to avoid cache conflicts, unless they are already set.
- Overlay patches are maintained as `.patch` files alongside the full `.go` files in `go-runner/overlay/`. Use `update-patch.sh` to regenerate.

## Release Process
Expand Down
10 changes: 7 additions & 3 deletions go-runner/src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ fn run_cmd<P: AsRef<Path>>(
cmd.args(&cli.packages);
cmd.current_dir(dir);

// Create isolated Go caches to avoid conflicts when tests run concurrently
cmd.env("GOCACHE", _dir.path().join("gocache"));
cmd.env("GOMODCACHE", _dir.path().join("gomodcache"));
// Create isolated Go caches to avoid conflicts when tests run concurrently.
// Caches set by the user are kept, so CI can restore the build cache between runs.
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));
}
}
Comment on lines +71 to +75

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


// The overlay includes instrument-hooks.go which uses cgo (`import "C"`).
// If CGO_ENABLED=0 (e.g. no C compiler on a bare metal runner), Go silently
Expand Down