diff --git a/docs/go/core/bzlmod.md b/docs/go/core/bzlmod.md index c95ca9cb7..a373b61d4 100644 --- a/docs/go/core/bzlmod.md +++ b/docs/go/core/bzlmod.md @@ -44,6 +44,10 @@ go_sdk.download( go_sdk.host() ``` +Nota bene: The use of `go_sdk.host()` [may break builds](https://github.com/enola-dev/enola/issues/713) whenever the host Go version is upgraded +(because many OS package managers, such as Debian/Ubuntu's `apt`, distribute Go into a directory which contains the version, such as `/usr/lib/go-1.22/`). +As package upgrades happen outside of Bazel's control, this will lead to non-reproducible builds. Due to this, use of `go_sdk.host()` is discouraged. + You can register multiple Go SDKs and select which one to use on a per-target basis using [`go_cross_binary`](rules.md#go_cross_binary). As long as you specify the `version` of an SDK, it will be downloaded lazily, that is, only when it is actually needed during a particular build. The usual rules of [toolchain resolution](https://bazel.build/extending/toolchains#toolchain-resolution) apply, with SDKs registered in the root module taking precedence over those registered in dependencies.