Skip to content

Commit 3099a14

Browse files
Mossakaclaude
andcommitted
fix: add GOROOT/bin to PATH in chroot mode for correct Go version
When GOROOT is provided (via AWF_GOROOT), the entrypoint now prepends $GOROOT/bin to PATH before exporting GOROOT. This ensures the correct Go version is found when actions/setup-go installs a specific version. Previously, only GOROOT was exported without adding its bin directory to PATH. This caused the system Go (e.g., 1.24.12) to be found instead of the setup-go version (e.g., 1.25.0) because AWF_HOST_PATH might have wrong ordering due to sudo resetting PATH. This matches how JAVA_HOME and CARGO_HOME are handled - their bin directories are prepended to PATH. Fixes gh-aw smoke-copilot test failure: "Go 1.24.12 < required 1.25.0" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 970c70c commit 3099a14

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

containers/agent/entrypoint.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,11 @@ AWFEOF
232232
# Java needs LD_LIBRARY_PATH to find libjli.so and other shared libs
233233
echo "export LD_LIBRARY_PATH=\"${AWF_JAVA_HOME}/lib:${AWF_JAVA_HOME}/lib/server:\$LD_LIBRARY_PATH\"" >> "/host${SCRIPT_FILE}"
234234
fi
235-
# Add GOROOT if provided (required for Go on GitHub Actions with trimmed binaries)
235+
# Add GOROOT/bin to PATH if provided (required for Go on GitHub Actions with trimmed binaries)
236+
# This ensures the correct Go version is found even if AWF_HOST_PATH has wrong ordering
236237
if [ -n "${AWF_GOROOT}" ]; then
237-
echo "[entrypoint] Using host GOROOT for chroot: ${AWF_GOROOT}"
238+
echo "[entrypoint] Adding GOROOT/bin to PATH: ${AWF_GOROOT}/bin"
239+
echo "export PATH=\"${AWF_GOROOT}/bin:\$PATH\"" >> "/host${SCRIPT_FILE}"
238240
echo "export GOROOT=\"${AWF_GOROOT}\"" >> "/host${SCRIPT_FILE}"
239241
fi
240242
else
@@ -251,9 +253,11 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
251253
# Add Cargo bin for Rust (common in development)
252254
[ -d "$HOME/.cargo/bin" ] && export PATH="$HOME/.cargo/bin:$PATH"
253255
AWFEOF
254-
# Add GOROOT if provided (required for Go on GitHub Actions with trimmed binaries)
256+
# Add GOROOT/bin to PATH if provided (required for Go on GitHub Actions with trimmed binaries)
257+
# This ensures the correct Go version is found even if PATH has wrong ordering
255258
if [ -n "${AWF_GOROOT}" ]; then
256-
echo "[entrypoint] Using host GOROOT for chroot: ${AWF_GOROOT}"
259+
echo "[entrypoint] Adding GOROOT/bin to PATH: ${AWF_GOROOT}/bin"
260+
echo "export PATH=\"${AWF_GOROOT}/bin:\$PATH\"" >> "/host${SCRIPT_FILE}"
257261
echo "export GOROOT=\"${AWF_GOROOT}\"" >> "/host${SCRIPT_FILE}"
258262
fi
259263
fi

0 commit comments

Comments
 (0)