Use external Go in recovery commands
This commit is contained in:
@@ -143,7 +143,7 @@ func selectedPublicationRecoveryCommand(ctx context.Context, result releasekit.P
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if args != nil {
|
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
|
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 {
|
for _, arg := range args.Args {
|
||||||
command += " " + shellQuote(git.DisplayDiagnostic(arg))
|
command += " " + shellQuote(git.DisplayDiagnostic(arg))
|
||||||
|
|||||||
@@ -280,9 +280,10 @@ func TestColdGoToolRecoverySurvivesLauncherExit(t *testing.T) {
|
|||||||
if scenario.record != "" {
|
if scenario.record != "" {
|
||||||
selected = strings.Replace(selected, shellQuote(originalRecord), shellQuote(scenario.record), 1)
|
selected = strings.Replace(selected, shellQuote(originalRecord), shellQuote(scenario.record), 1)
|
||||||
}
|
}
|
||||||
recovery := exec.Command("sh", "-c", selected)
|
|
||||||
recovery.Dir = t.TempDir()
|
|
||||||
foreignOS, foreignArch := foreignTarget()
|
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)
|
recovery.Env = setEnvironment(setEnvironment(os.Environ(), "GOOS", foreignOS), "GOARCH", foreignArch)
|
||||||
recovered, err := recovery.CombinedOutput()
|
recovered, err := recovery.CombinedOutput()
|
||||||
if scenario.status == 0 && err != nil || scenario.status != 0 && (!errors.As(err, &exitError) || exitError.ExitCode() != scenario.status) {
|
if scenario.status == 0 && err != nil || scenario.status != 0 && (!errors.As(err, &exitError) || exitError.ExitCode() != scenario.status) {
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ invocation recipes, product checks, and publication recovery.
|
|||||||
|
|
||||||
### Use the external Go executable in printed recovery commands
|
### 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
|
**Evidence:** Before host normalization, the
|
||||||
[command formatter](../../cmd/releasekit/main.go) emitted
|
[command formatter](../../cmd/releasekit/main.go) emitted
|
||||||
`env GOWORK=off GOTOOLCHAIN=local go ...`, which resolves Go through `PATH`.
|
`env GOWORK=off GOTOOLCHAIN=local go ...`, which resolves Go through `PATH`.
|
||||||
|
|||||||
Reference in New Issue
Block a user