Hi folks, is cross-compilation for Go supported, o...
# general
t
Hi folks, is cross-compilation for Go supported, or are there any alternative solutions on how to target different platforms? Trying to set
GOOS
and
GOARCH
in
subprocess_env_vars
doesn't seem to work.
c
There's an experimental feature: "environments", that allows you to run select parts in containers (or on remote builders) for this purpose: https://www.pantsbuild.org/2.19/docs/using-pants/environments
t
But with this feature I cannot build a binary for lets say darwin/arm64 if the host is linux/amd64 right? I’ll need to target a remote builder thats compatible with that platform?
c
yea, using containers, you mostly get linux covered..
f
it seems like we should be able to support this though, since cross-compilation is something go supports natively without containers or hardware emulation
👍 4
t
I’m curious if there are any plans to add this feature to the roadmap in the near future? Searching through the channels it seems other folks have encountered this problem as well.
f
We talked about this recently, and it's mostly just needing more contributors to and users of the Go backend. The person that put most of the work into it doesn't really have the time to take it further with their new job I don't think.
t
I understand, thanks for the info!
f
If you find it useful, we're very open to contributions in this area. Even just well-written issues and feedback can help us quite a bit.
t
Of course, we’re still evaluating the tool, and we love it so far, this is not something that is a dealbreaker. I’ll be happy to contribute in any way I can.
😌 1
g
If you have the time @thankful-magician-7427, can you bump and add some more info on your use-case/workflow a tiny bit here? https://github.com/pantsbuild/pants/issues/14197. I'm going to add a tiny bit of support for this in my Rust plugin when I have the time, and I imagine go and Rust will have similar needs/constraints.
t
Sure thing 👍
🙇 1