cmd/golangorg: return all known Go toolchain versions
Update https://go.dev/dl/mod/golang.org/toolchain/@v/list to list
all known toolchain versions. This previously only listed the
stable versions.
Returning only the stable versions of go was inconsistent with
proxy.golang.org, leading to a different experience when running the
go command with GOPROXY=direct. This prevented the go command from
identifying newer versions of the toolchain that have been released.
Fixes golang/go#61359
Change-Id: I09729cc4826e40e5d5ee1effff6ed476ff983595
Reviewed-on: https://go-review.googlesource.com/c/website/+/551595
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/cmd/golangorg/testdata/web.txt b/cmd/golangorg/testdata/web.txt
index bdff81d..834a928 100644
--- a/cmd/golangorg/testdata/web.txt
+++ b/cmd/golangorg/testdata/web.txt
@@ -441,6 +441,11 @@
body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.darwin-amd64$
body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.linux-386$
body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.windows-amd64$
+body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.darwin-arm64$
+body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.darwin-amd64$
+body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.linux-386$
+body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.windows-amd64$
+body !contains bootstrap
GET https://go.dev/ref
redirect == /doc/#references
diff --git a/internal/dl/server.go b/internal/dl/server.go
index 8dc1c7d..491c0cb 100644
--- a/internal/dl/server.go
+++ b/internal/dl/server.go
@@ -81,7 +81,6 @@
}
// toolchainList serves the toolchain module version list.
-// We only list the stable releases, even though older releases are available as well.
func (h server) toolchainList(w http.ResponseWriter, r *http.Request) {
d, err := h.listData(r.Context())
if err != nil {
@@ -91,22 +90,24 @@
}
var buf bytes.Buffer
- for _, r := range d.Stable {
- for _, f := range r.Files {
- if f.Kind != "archive" {
- continue
+ for _, l := range [][]Release{d.Stable, d.Unstable, d.Archive} {
+ for _, r := range l {
+ for _, f := range r.Files {
+ if f.Kind != "archive" || f.Arch == "bootstrap" {
+ continue
+ }
+ buf.WriteString("v0.0.1-")
+ buf.WriteString(f.Version)
+ buf.WriteString(".")
+ buf.WriteString(f.OS)
+ buf.WriteString("-")
+ arch := f.Arch
+ if arch == "armv6l" {
+ arch = "arm"
+ }
+ buf.WriteString(arch)
+ buf.WriteString("\n")
}
- buf.WriteString("v0.0.1-")
- buf.WriteString(f.Version)
- buf.WriteString(".")
- buf.WriteString(f.OS)
- buf.WriteString("-")
- arch := f.Arch
- if arch == "armv6l" {
- arch = "arm"
- }
- buf.WriteString(arch)
- buf.WriteString("\n")
}
}
w.Write(buf.Bytes())