Description
Per the discussion in #53383 we should develop a way to build a cross-compiled Go release, without requiring a C cross-compiler, but such that the release will itself default to using cgo as usual. This means that the first time that this new release is used, it will invoke the system C compiler to build the packages that require cgo: the net, os/user, and runtime/cgo packages. Those packages, built with cgo, will thereafter live in the build cache.
We will then be able to use this mechanism as part of our release process to automatically, easily, and safely build releases for a range for second ports. For first-class ports I expect that we will continue to build the releases on the systems themselves with full cgo support included. But for secondary ports we don't want to rely on having a builder for the approach system. A cross-compiled release will be easy for our users to download and use.
A disadvantage of this is that the cmd/go program included in the cross-compiled binary release will be built without cgo, meaning that it will only use the Go DNS resolver. This is mostly fine, and for cases where it is not fine people can fix the problem by running go install cmd/go
. However, this will require documentation.
The actual implementation of this may be very similar to the existing bootstrap.bash script, but with some tweaks to ensure that the generated release will default to using cgo.
Of course for secondary ports that do not support cgo (currently linux/ppc64, js/wasm, plan9/*, windows/arm) the generated binary release should not expect to use cgo by default.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status