-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: falls back to subsequent proxies too early during package resolution #31785
Comments
See related discussion on CL 173441 (#26334). |
We should also clarify what happens if |
I talked with Russ and we decided that the fallback stops at |
Change https://golang.org/cl/177958 mentions this issue: |
This appears to be happening at tip, either still or again -- I never verified the fix myself.
|
What's going on there is that we're looking for an exact hit for the module (from the proxy and then from the origin), and then searching all possible module paths in the proxy, and then all possible module paths from the origin. This only affects CC @jayconrod @rsc for thoughts. |
Change https://golang.org/cl/189517 mentions this issue: |
I have a candidate fix, although it does change the meaning of |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No, the feature doesn't exist.
What did you do?
$ GOPROXY=https://proxy.golang.org,direct go get -x -v golang.org/x/tools/cmd/goimports
What did you expect to see?
Requests only to the proxy, then a successful build of
goimports
.What did you see instead?
One request to the proxy, then a git clone, then alternating between the two until success.
Package to module resolution walks up from the package name looking for a module, and during that walk it's expected to encounter 404s until it finds the actual module path. Those 404s trigger fallback to the next fetch method.
I don't know this code very well but I think this would cause at least two problems: First, the name of the requested package leaks to the subsequent source. If the first source is a corporate proxy and the second is proxy.golang.org, that could be a problem. Second, if the second source is unavailable for some reason, like an offline origin, I suspect the entire
go get
command will fail.Marking as a release blocker since this seems to seriously undercut the intended uses of the feature.
@rsc
The text was updated successfully, but these errors were encountered: