fix(ci): use explicit if-guards for GOOS/GOARCH re-export in run_task.sh

Harden the cross-compile target re-export against `set -e`: the prior
`[ -n "$x" ] && export ...` form returns non-zero when the var is empty
(the common native-build case). Empirically bash exempts it from
errexit, but the explicit `if` form is unambiguous across shells. Both
native (Mach-O arm64) and cross (ELF linux/amd64) builds verified via
./scripts/run_task.sh build.

Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
Antje Worring
2026-06-07 00:52:43 -07:00
co-authored by Hanzo Dev
parent fd196b7da3
commit 8e3f3e60d1
+6 -2
View File
@@ -26,7 +26,11 @@ else
env -u GOOS -u GOARCH GOBIN="${bin_dir}" go install github.com/go-task/task/v3/cmd/task@v3.39.2
# Re-export the cross-compile target so the build step inside the task
# (scripts/build.sh -> `go build`) produces the requested artifact.
[ -n "${target_goos}" ] && export GOOS="${target_goos}"
[ -n "${target_goarch}" ] && export GOARCH="${target_goarch}"
if [ -n "${target_goos}" ]; then
export GOOS="${target_goos}"
fi
if [ -n "${target_goarch}" ]; then
export GOARCH="${target_goarch}"
fi
exec "${task_bin}" "${@}"
fi