-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go/internal/modfetch: re-evaluate the undocumented proxy behavior in proxyRepo.latest() #32789
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
Comments
This comment has been minimized.
This comment has been minimized.
As an observation, the last paragraph at https://golang.org/cmd/go/#hdr-Module_proxy_protocol says:
If one looks inside the local module cache as produced by
|
Change https://golang.org/cl/190838 mentions this issue: |
I think we should confirm no proxies are using extra fields. If there are none, we should start rejecting them in 1.14. Currently, it looks like this can be used to set timestamps. We only really need timestamps for ordering pseudo-versions, and the timestamp should match the timestamp encoded in the pseudo-version, so there's no need to specify it separately.
CL 190838 updates Note that go1.13 treats In go1.13, if In go1.12 and earlier, if So if a proxy stopped serving |
Updates #32789 Change-Id: Ie5e8e3b7b6a923aa9068c8af3ac8f081bd92c830 Reviewed-on: https://go-review.googlesource.com/c/go/+/190838 Reviewed-by: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Forked from the discussion during the review of https://golang.org/cl/183402
/@v/list
formatproxyRepo.latest()
assumes/@v/list
could return a list of version, commit timestamp pairs. This is not documented in the proxy protocol doc, and I am not sure if there is any proxy that's following this format. Please reject the undocumented format or document it.One of the benefit of preserving this feature is, when this
proxyRepo.latest()
is invoked, the commit timestamp info here is more reliable than the timestamp parsed from the pseudo-version like version string and helps avoiding an extraproxyRepo.Stat()
call. On the other hand, the code path can be completely eliminated if proxies implement the/@latest
endpoint, which is also not documented./@v/list
The
proxyRepo.latest()
itself is also relying on part of undocumented behavior of/@v/list
, which is supposed to include pseudo-versions. Before https://golang.org/cl/183402 (pre-1.13), we assumed it's not a good idea to include the pseudo versions in the/@v/list
output and planned to include that in the proxy protocol spec.https://go-review.googlesource.com/c/mod/+/176540/5/proxy/server.go#40
If the spec draft is valid, the
proxyRepo.latest()
implementation doesn't do anything but an extra network round trip for the proxies that follow the spec. If the go command can handle the list output including pseudo-versions, we may want to revisit the decision.So, I propose either
/@latest
endpoint. Then, remove the code that leads to theproxyRepo.latest()
, or/@v/list
format and allow pseudo versions in its output, and document it.Option 2)
implies more code to maintain oncmd/go
side.Option 1)
implies breakage of proxies that doesn't implement the/@latest
endpoint.p.s. having the go command's
proxyRepo.Versions
ensure not to return pseudo versions is a good fix though.The text was updated successfully, but these errors were encountered: