Skip to content

Commit 813bd0c

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 95f774f commit 813bd0c

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

cmd/golangorg/testdata/web.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.darwin-arm64$
441441
body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.darwin-amd64$
442442
body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.linux-386$
443443
body ~ (?m)^v0\.0\.1-go1\.\d+\.\d+.windows-amd64$
444+
body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.darwin-arm64$
445+
body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.darwin-amd64$
446+
body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.linux-386$
447+
body ~ (?m)^v0\.0\.1-go1\.\d+rc\d+\.windows-amd64$
448+
body !contains bootstrap
444449

445450
GET https://go.dev/ref
446451
redirect == /doc/#references

internal/dl/server.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func (h server) listHandler(w http.ResponseWriter, r *http.Request) {
8181
}
8282

8383
// toolchainList serves the toolchain module version list.
84-
// We only list the stable releases, even though older releases are available as well.
8584
func (h server) toolchainList(w http.ResponseWriter, r *http.Request) {
8685
d, err := h.listData(r.Context())
8786
if err != nil {
@@ -91,22 +90,24 @@ func (h server) toolchainList(w http.ResponseWriter, r *http.Request) {
9190
}
9291

9392
var buf bytes.Buffer
94-
for _, r := range d.Stable {
95-
for _, f := range r.Files {
96-
if f.Kind != "archive" {
97-
continue
93+
for _, l := range [][]Release{d.Stable, d.Unstable, d.Archive} {
94+
for _, r := range l {
95+
for _, f := range r.Files {
96+
if f.Kind != "archive" || f.Arch == "bootstrap" {
97+
continue
98+
}
99+
buf.WriteString("v0.0.1-")
100+
buf.WriteString(f.Version)
101+
buf.WriteString(".")
102+
buf.WriteString(f.OS)
103+
buf.WriteString("-")
104+
arch := f.Arch
105+
if arch == "armv6l" {
106+
arch = "arm"
107+
}
108+
buf.WriteString(arch)
109+
buf.WriteString("\n")
98110
}
99-
buf.WriteString("v0.0.1-")
100-
buf.WriteString(f.Version)
101-
buf.WriteString(".")
102-
buf.WriteString(f.OS)
103-
buf.WriteString("-")
104-
arch := f.Arch
105-
if arch == "armv6l" {
106-
arch = "arm"
107-
}
108-
buf.WriteString(arch)
109-
buf.WriteString("\n")
110111
}
111112
}
112113
w.Write(buf.Bytes())

0 commit comments

Comments
 (0)