diff --git a/cmd/releasekit/main.go b/cmd/releasekit/main.go index 33fbe6c..4ef1e3f 100644 --- a/cmd/releasekit/main.go +++ b/cmd/releasekit/main.go @@ -143,7 +143,7 @@ func selectedPublicationRecoveryCommand(ctx context.Context, result releasekit.P return "", err } if args != nil { - prefix := "go -C " + shellQuote(git.DisplayDiagnostic(args.Directory)) + prefix := "env go -C " + shellQuote(git.DisplayDiagnostic(args.Directory)) command := "(export GOWORK=off GOTOOLCHAIN=local && releasekit_host_os=$(" + prefix + " env GOHOSTOS) && releasekit_host_arch=$(" + prefix + " env GOHOSTARCH) && GOOS=\"$releasekit_host_os\" GOARCH=\"$releasekit_host_arch\" " + prefix for _, arg := range args.Args { command += " " + shellQuote(git.DisplayDiagnostic(arg)) diff --git a/cmd/releasekit/publication_handoff_test.go b/cmd/releasekit/publication_handoff_test.go index 7f51bd3..6238ff0 100644 --- a/cmd/releasekit/publication_handoff_test.go +++ b/cmd/releasekit/publication_handoff_test.go @@ -280,9 +280,10 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) { if scenario.record != "" { selected = strings.Replace(selected, shellQuote(originalRecord), shellQuote(scenario.record), 1) } - recovery := exec.Command("sh", "-c", selected) - recovery.Dir = t.TempDir() foreignOS, foreignArch := foreignTarget() + goFunction := "go() { GOOS=" + shellQuote(foreignOS) + " GOARCH=" + shellQuote(foreignArch) + " command go \"$@\"; }\n" + recovery := exec.Command("sh", "-c", goFunction+selected) + recovery.Dir = t.TempDir() recovery.Env = setEnvironment(setEnvironment(os.Environ(), "GOOS", foreignOS), "GOARCH", foreignArch) recovered, err := recovery.CombinedOutput() if scenario.status == 0 && err != nil || scenario.status != 0 && (!errors.As(err, &exitError) || exitError.ExitCode() != scenario.status) { diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index 58c85c5..73f386e 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -94,6 +94,8 @@ invocation recipes, product checks, and publication recovery. ### Use the external Go executable in printed recovery commands +**Completed.** All three Go invocations use external lookup through `PATH`. The handoff regression reproduces the shell-function failure before the fix and verifies reconciliation afterward. + **Evidence:** Before host normalization, the [command formatter](../../cmd/releasekit/main.go) emitted `env GOWORK=off GOTOOLCHAIN=local go ...`, which resolves Go through `PATH`.