Skip to content

community/go: enable support for toolchain downloading

Sören Tempel requested to merge nmeum/aports:go-toolchain-download into master

Initially, toolchain downloading was forcefully disabled (i.e. users were not able to opt-in) because it didn't work on Alpine as many of the pre-built Go toolchain provided by Google are dynamically linked against glibc (see !48279 (comment 319620)). However, I recently became aware that, starting with Go 1.21.0 (the most recent version), the Go toolchain is a fully statically linked binary. Thus, toolchain downloading will work on Alpine for Go >=1.21.0. Automatic toolchain downloading will only fetch new toolchain, users can explicitly request an older Go version via GOTOOLCHAIN in which case it will not work on Alpine.

This commit removes our patch which forcefully disables the new Go toolchain downloading feature. Note that, we still set GOTOOLCHAIN to local in go.env (i.e. we won't attempt to download new toolchain versions by default unless the user enables this explicitly).

I am opening this as an MR as there are still some privacy/packaging concern that may be worthwhile discussing here in the spirit of !26774 (closed). That is, are we ok with packages downloading pre-built binaries from the internet? Do we want users to be able to obtain a version of Go that does not include our patches (meaning it may not work on some architectures etc.)? What if a packages sets GOTOOLCHAIN=auto before invoking Go (e.g. in a Makefile)? …

Again, keep in mind that toolchain downloading is, by default, disabled via go.env (i.e. it is opt-in).

See also:

Edited by Sören Tempel

Merge request reports