copilot-sdk
copilot-sdk copied to clipboard
fix(go): select the host CLI package in E2E tests
Closes #2116.
What this changes
The Go E2E harness now derives exact @github/copilot-<platform>-<arch>
package candidates from ffihost.PrebuildsFolder() instead of globbing every
copilot-* directory and taking the first sorted result.
- macOS and Windows probe only their exact host package;
- Linux probes the detected glibc/musl package first and the sibling libc variant second;
- unrelated or foreign-platform
copilot-*packages are ignored; CLIPath(testing.TB)reports the packages tried and those actually present, replacing the duplicated empty-path guards at its call sites; andgo/test.shapplies the same exact host OS/architecture mapping.
The shared .github/actions/setup-copilot action is intentionally unchanged,
as called out in the Issue.
Tests
Added unit coverage for:
- macOS, Windows, Linux glibc, and Linux musl candidate generation;
- ignoring alphabetically earlier foreign and non-platform packages;
- respecting Linux libc candidate order;
- rejecting a package without an
index.js; and - listing installed packages for failure diagnostics.
Local validation:
GOTOOLCHAIN=go1.24.0 go test ./internal/e2e/testharnessgo test ./...env -u COPILOT_CLI_PATH bash test.shCOPILOT_SDK_DEFAULT_CONNECTION=inprocess GOFLAGS=-tags=copilot_inprocess env -u COPILOT_CLI_PATH bash test.shgolangci-lint run ./... --timeout=5m(0 issues)bash -n go/test.sh- cross-compiled the testharness tests for Linux, Windows, and macOS on amd64 and arm64
Both the default and in-process full race-enabled test runs passed.