Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.gentoo.dev > #70432
| From | James Le Cuirot <chewi@gentoo.org> |
|---|---|
| Newsgroups | linux.gentoo.dev |
| Subject | [gentoo-dev] [PATCH 4/4] go-env.eclass: Create named go run wrapper rather than using -exec |
| Date | 2026-04-20 14:00 +0200 |
| Message-ID | <MLVsd-gCja-1@gated-at.bofh.it> (permalink) |
| References | <MLVix-gCfC-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Some projects unset GOOS and GOARCH before running `go run` in order to
force the build host. Giving the wrapper using `GOFLAGS="-exec=..."`
breaks this because that expects the target host. `go run` can also find
the wrapper in the PATH as `go_${GOOS}_${GOARCH}_exec`, so take this
more targetted approach instead.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
eclass/go-env.eclass | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
index f8de40a596d0..af843a8e81ba 100644
--- a/eclass/go-env.eclass
+++ b/eclass/go-env.eclass
@@ -167,9 +167,12 @@ go-env_set_compile_environment() {
# go run will build binaries for the target system and try to execute them.
# This will fail when cross-compiling unless you provide a wrapper.
- local script
+ local script go_exec
if script=$(sysroot_make_run_prefixed); then
- GOFLAGS+=" -exec=${script}" "${@}"
+ go_exec="${T}/go-exec"
+ PATH="${go_exec}:${PATH}"
+ mkdir -p "${go_exec}" || die
+ ln -snfr "${script}" "${go_exec}/go_${GOOS}_${GOARCH}_exec" || die
fi
}
--
2.53.0
Back to linux.gentoo.dev | Previous | Next — Previous in thread | Find similar
[gentoo-dev] [PATCH 1/4] go-env.eclass: Support EAPI 9 James Le Cuirot <chewi@gentoo.org> - 2026-04-20 13:50 +0200 [gentoo-dev] [PATCH 2/4] go-module.eclass: Support EAPI 9 with new src_configure phase function James Le Cuirot <chewi@gentoo.org> - 2026-04-20 13:50 +0200 [gentoo-dev] [PATCH 4/4] go-env.eclass: Create named go run wrapper rather than using -exec James Le Cuirot <chewi@gentoo.org> - 2026-04-20 14:00 +0200
csiph-web