Skip to content

Commit 212a0a0

Browse files
fix: fix instropected_go's behavior on macos
On macos a symlink breaks the existing test creating an infinite loop where `instropected_go` detects itself as the real `go` executable. Fixed by changing the behavior to what instrospected_node does.
1 parent 02042d5 commit 212a0a0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • src/executor/helpers/introspected_golang

src/executor/helpers/introspected_golang/go.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ if [ "${CODSPEED_RUNNER_MODE:-}" != "walltime" ]; then
1818
exit 1
1919
fi
2020

21-
# Find the real go binary, so that we don't end up in infinite recursion
22-
REAL_GO=$(which -a go | grep -v "$(realpath "$0")" | head -1)
21+
# Find the real go binary by removing our directory from PATH (same approach as node.sh)
22+
ORIGINAL_PATH=$(echo "$PATH" | tr ":" "\n" | grep -v "codspeed_introspected_go" | tr "\n" ":")
23+
REAL_GO=$(env PATH="$ORIGINAL_PATH" which go 2>/dev/null || true)
24+
debug_log "Real go path: $REAL_GO"
2325
if [ -z "$REAL_GO" ]; then
2426
echo "ERROR: Could not find real go binary" >&2
2527
exit 1

0 commit comments

Comments
 (0)