late-keyboard-89314
12/05/2023, 6:39 PMgo_binary targets for multiple platforms, and right now it’s achievable through `environment`s primarily. But given how good Go’s cross-compliation support is, it seems odd to me that there’s (as far as I can tell) no native pants way to do that. What I’d propose is something similar to the docker_image target’s build_platform field, so you could do something like this for a Go target:
go_binary(
name="bin"
go_os=["linux"]
go_arch=["amd64", "arm64"]
)
and end up with bin_linux_amd64 and bin_linux_arm64 in your dist/ outputs. Thoughts? Is there already a clean way to do this that I’m missing?curved-television-6568
12/05/2023, 6:50 PMgo takes them as a single invocation to produce all outputs at once. That is, to preserve one target one compilation. You can then leverage parametrization to create all variants as needed, and you have the ability to interact with each specific target if needed.late-keyboard-89314
12/05/2023, 6:51 PMhundreds-father-404
12/05/2023, 7:19 PMparametrize. That fits with Pants's mental model really well: a target like go_binary corresponds 1:1 w/ a single binary artifact
@fast-nail-55400 and I were two of the original authors of the Go backend. This change makes sense to me. I don't remember exactly, but suspect cross-compilation mostly wasn't implemented due to simple prioritization