New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/website/internal/dl: make https://golang.org/dl/{file} URLs more useful #38713
Comments
I think we can fix this issue by changing the links on the https://golang.org/dl/ HTML page to use Am I missing any context? Thoughts? |
IIRC the original point of that handler was just to make But once we had the go-get metadata, we needed to do something the URLs about non-cmd/go clients. That was never the goal, though. |
In 2015, func getHandler(w http.ResponseWriter, r *http.Request) {
name := strings.TrimPrefix(r.URL.Path, "/dl/")
if name == "" {
listHandler(w, r)
return
}
if !fileRe.MatchString(name) {
http.NotFound(w, r)
return
}
http.Redirect(w, r, gcsBaseURL+name, http.StatusFound)
} The ?go-get=1 code path for |
There haven't been concerns or objections raised regarding the solution I suggested in #38713 (comment). I plan to proceed with it soon. In the unlikely case we learn of something that goes poorly as a result, this will be easy to undo. |
Change https://golang.org/cl/238517 mentions this issue: |
The /dl/{file} URLs have been supported for many years but not well documented. Start using them on the /dl/ HTML page and document them, so that it is clear that they can be reliably used in scripts or so. This causes clients to have to make an extra HTTP request (which gets redirected to the target location serving the file bytes), but compared to the total work to download a Go file, this is negligible. Clients that really want to skip the redirect can do so, but the trade-off is that they need to update the URL if the CDN used for Go file downloads happens to change. The /dl/{file} links are not expected to change for Go 1. Fixes golang/go#38713. Change-Id: I9df7d5b761baa6fa657c5dd2063c97b9b457367c Reviewed-on: https://go-review.googlesource.com/c/website/+/238517 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
Go binary downloads have been available at the URL
https://golang.org/dl/{file}
since at least 2015 (see CL 14842). That URL serves a 302 Found redirect to another URL which serves the actual bytes. The exact target of redirection is an implementation detail that has changed over the years (e.g., most recently in CL 76971).The
https://golang.org/dl/{file}
URL is short, memorable, has golang.org in it, and has been around for long enough that it's temping to perceive to be more future-proof than any URL it happens to point to (similar to how https://golang.org/issue/123 is more future-proof than a direct link to an issue tracker, https://code.google.com/p/go/issues/detail?id=123).However, as far as I can tell so far, it doesn't seem to be used on golang.org or documented anywhere:
https://golang.org/dl/{file}
, which ishttps://dl.google.com/go/{file}
since 2017.golang.org/x/website/internal/dl
documentation doesn't mention it.The only documentation seems to be the source code. That makes it difficult to recommend as a future-proof URL (to use in scripts, etc.) despite the favorable properties above.
Also see #22648 (it was about the redirect target URLs).
/cc @andybons @mvdan @adg @broady @bradfitz
The text was updated successfully, but these errors were encountered: