go_download_sdk: download release table from golang.org/dl#2729
go_download_sdk: download release table from golang.org/dl#2729jayconrod merged 2 commits intobazel-contrib:masterfrom
Conversation
If the sdks attribute is not set, go_download_sdk will now download a list of available releases from https://golang.org/dl. If the version attribute is not set, go_download_sdk will pick the highest available version (and Bazel will tell users to set the version attribute for a reproducible build). Even if version is set, we need to download the release list in order to get the SHA-256 sums. Bazel won't cache downloads without an SHA-256 sum. go_register_toolchains now requires the version argument (previously named go_version, which is still allowed) if no toolchain was declared earlier. With this change, rules_go no longer requires an update after a new Go version is released. Fixes bazel-contrib#2405
|
This is AMAZING, @jayconrod, and will make my life easier updating Golang in the Kubernetes project! Will we be able to support pulling in Golang pre-releases as a result of this change? |
@justaugustus Glad to help! Mostly looking for ways to reduce toil.
I think so. https://pkg.go.dev/golang.org/x/website/internal/dl has the doc on the endpoint I'm querying to list release file names and SHA-256 sums. It says unstable releases should be included. There aren't actually any unstable releases at the moment, so I can't test that. Even if that doesn't work, you can already pull in unstable releases by setting the |
|
Awesome! I actually borrowed some code from you to accomplish this: It'll be nice to test this out in the next Golang prerelease. Thanks again! |
|
This seems to have broken go sdk extraction again by removing the workaround for bazelbuild/bazel#7055 -- I get the following output using bazel 3.7.1 and rules_go 0.25.0: My |
|
@swsnider Please open a new issue. |
|
Opened #2771 |
If the sdks attribute is not set, go_download_sdk will now download a
list of available releases from https://golang.org/dl. If the version
attribute is not set, go_download_sdk will pick the highest available
version (and Bazel will tell users to set the version attribute for a
reproducible build). Even if version is set, we need to download the
release list in order to get the SHA-256 sums. Bazel won't cache
downloads without an SHA-256 sum.
go_register_toolchains now requires the version argument (previously
named go_version, which is still allowed) if no toolchain was declared
earlier.
With this change, rules_go no longer requires an update after a new Go
version is released.
Fixes #2405