From 78678fb5d61459f6a3905918b63149d1c7282bde Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 9 Feb 2026 12:31:00 +0100 Subject: [PATCH 1/2] chore: add debug logs for harvested bench pids --- src/executor/wall_time/perf/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/executor/wall_time/perf/mod.rs b/src/executor/wall_time/perf/mod.rs index e48e25d3..6792ba99 100644 --- a/src/executor/wall_time/perf/mod.rs +++ b/src/executor/wall_time/perf/mod.rs @@ -297,6 +297,7 @@ impl BenchmarkData { // maps from /tmp to the profile folder. We have to write our own perf // maps to these files AFTERWARDS, otherwise it'll be overwritten! let bench_pids = symbols_by_pid.keys().copied().collect(); + debug!("Harvesting perf maps and jit dumps for pids: {bench_pids:?}"); harvest_perf_maps_for_pids(path_ref, &bench_pids) .await .map_err(|e| { From f4875b1c881917bcba361a4cbc18b8f8fe4e63a8 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Mon, 9 Feb 2026 12:42:35 +0100 Subject: [PATCH 2/2] feat: force necessary flags for `go run` in introspected go Users should prefer `go build` -> codspeed exec -- ./my_binary` workflow but this allows basic support for `go run .` These flags are necessary to 1. Keep the binary after `go run` completes, for symbol and debug info parsing 2. Not strip symbols and debug infos from the binary `GOFLAGS` do not work with either of these forms `GOFLAGS="-work -ldflags=-s=false -ldflags=-w=false"` `GOFLAGS="-work -ldflags='-s=false -w=false'"` `GOFLAGS='-work -ldflags="-s=false -w=false"'` Ended up giving up and relying on the introspected go --- .../helpers/introspected_golang/go.sh | 62 +++++++++++-------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/src/executor/helpers/introspected_golang/go.sh b/src/executor/helpers/introspected_golang/go.sh index 0ff727db..10f4ce55 100755 --- a/src/executor/helpers/introspected_golang/go.sh +++ b/src/executor/helpers/introspected_golang/go.sh @@ -32,34 +32,44 @@ if [ $# -eq 0 ]; then exit $? fi -# Check if first argument is "test" -if [ "$1" = "test" ]; then - debug_log "Detected 'test' command, routing to go-runner" +# Route command based on first argument +case "$1" in + test) + debug_log "Detected 'test' command, routing to go-runner" - # Find go-runner or install if not found - GO_RUNNER=$(which codspeed-go-runner 2>/dev/null || true) - if [ -z "$GO_RUNNER" ]; then - # Build the installer URL with the specified version or use latest - INSTALLER_VERSION="${CODSPEED_GO_RUNNER_VERSION:-latest}" - if [ "$INSTALLER_VERSION" = "latest" ]; then - DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/latest/download/codspeed-go-runner-installer.sh" - echo "::warning::Installing the latest version of codspeed-go-runner. This can silently introduce breaking changes. We recommend pinning a specific version via the \`go-runner-version\` option in the action." >&2 - else - DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/download/v${INSTALLER_VERSION}/codspeed-go-runner-installer.sh" - fi - - debug_log "Installing go-runner from: $DOWNLOAD_URL" - curl -fsSL "$DOWNLOAD_URL" | bash -s -- --quiet + # Find go-runner or install if not found GO_RUNNER=$(which codspeed-go-runner 2>/dev/null || true) - fi + if [ -z "$GO_RUNNER" ]; then + # Build the installer URL with the specified version or use latest + INSTALLER_VERSION="${CODSPEED_GO_RUNNER_VERSION:-latest}" + if [ "$INSTALLER_VERSION" = "latest" ]; then + DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/latest/download/codspeed-go-runner-installer.sh" + echo "::warning::Installing the latest version of codspeed-go-runner. This can silently introduce breaking changes. We recommend pinning a specific version via the \`go-runner-version\` option in the action." >&2 + else + DOWNLOAD_URL="http://github.com/CodSpeedHQ/codspeed-go/releases/download/v${INSTALLER_VERSION}/codspeed-go-runner-installer.sh" + fi - debug_log "Using go-runner at: $GO_RUNNER" - debug_log "Full command: RUST_LOG=info $GO_RUNNER $*" + debug_log "Installing go-runner from: $DOWNLOAD_URL" + curl -fsSL "$DOWNLOAD_URL" | bash -s -- --quiet + GO_RUNNER=$(which codspeed-go-runner 2>/dev/null || true) + fi - "$GO_RUNNER" "$@" -else - debug_log "Detected non-test command ('$1'), routing to standard go binary" - debug_log "Full command: $REAL_GO $*" - "$REAL_GO" "$@" -fi + debug_log "Using go-runner at: $GO_RUNNER" + debug_log "Full command: RUST_LOG=info $GO_RUNNER $*" + + "$GO_RUNNER" "$@" + ;; + run) + debug_log "Detected 'run' command, injecting -work -ldflags flags" + # Insert flags after 'run' but before other arguments + # This is needed because GOFLAGS cannot handle spaces in ldflags... + debug_log "Full command: $REAL_GO run -work -ldflags=\"-s=false -w=false\" ${*:2}" + "$REAL_GO" run -work -ldflags="-s=false -w=false" "${@:2}" + ;; + *) + debug_log "Detected non-test command ('$1'), routing to standard go binary" + debug_log "Full command: $REAL_GO $*" + "$REAL_GO" "$@" + ;; +esac exit $?