You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GOPROXY environment variable may contain list of proxy URLs, that should be tried in turn. I found edge case, where multiple proxies are handled incorrectly.
prime@bee /> mkdir /tmp/bug
prime@bee />cd /tmp/bug
prime@bee /t/bug> mkdir bugmod emptygopath proxy0 proxy1 tmpmod
prime@bee /t/bug># Initialize first proxy.
prime@bee /t/bug>cd tmpmod
prime@bee /t/b/tmpmod> go mod init tmpmod
go: creating new go.mod: module tmpmod
prime@bee /t/b/tmpmod> env GOPATH=/tmp/bug/proxy0 go get rsc.io/quote
go: downloading rsc.io/quote v1.5.2
go: rsc.io/quote upgrade => v1.5.2
go: downloading rsc.io/sampler v1.3.0
go: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
prime@bee /t/b/tmpmod> env GOPATH=/tmp/bug/proxy0 go mod download
prime@bee /t/b/tmpmod># Initialize second proxy.
prime@bee /t/b/tmpmod> env GOPATH=/tmp/bug/proxy1 go get rsc.io/quote/v3
go: downloading rsc.io/quote v1.5.2
go: downloading rsc.io/quote/v3 v3.1.0
go: rsc.io/quote/v3 upgrade => v3.1.0
go: downloading rsc.io/sampler v1.3.0
go: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
prime@bee /t/b/tmpmod> env GOPATH=/tmp/bug/proxy1 go mod download
prime@bee /t/b/tmpmod># Trigger bug.
prime@bee /t/b/tmpmod>cd ../bugmod
prime@bee /t/b/bugmod> go mod init bugmod
prime@bee /t/b/bugmod> env GOPATH=/tmp/bug/emptygopath GOPROXY=file:///tmp/bug/proxy0/pkg/mod/cache/download,file:///tmp/bug/proxy1/pkg/mod/cache/download go get rsc.io/quote/v3
go: downloading rsc.io/quote v1.5.2
go get rsc.io/quote/v3: module rsc.io/quote@upgrade found (v1.5.2), but does not contain package rsc.io/quote/v3
What did you expect to see?
go get downloading rsc.io/quote/v3 module from the second proxy.
What did you see instead?
go get command is downloading rsc.io/quote module from the first proxy and failing with error.
The text was updated successfully, but these errors were encountered:
slon
changed the title
go get gets confused by multiple module proxies
go get is selecting incorrect module, when using multiple proxies
Aug 10, 2020
andybons
changed the title
go get is selecting incorrect module, when using multiple proxies
cmd/go: go get is selecting incorrect module, when using multiple proxies
Aug 11, 2020
jayconrod
changed the title
cmd/go: go get is selecting incorrect module, when using multiple proxies
cmd/go: package resolution fails after selecting incorrect module when using multiple proxies
Aug 12, 2020
jayconrod
added
modules
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Aug 12, 2020
go get attempts to resolve each package named in its arguments to a module. In the last command, since no module in the build list provides rsc.io/quote/v3, the go command will try to download the modules rsc.io, rsc.io/quote, and rsc.io/quote/v3 from the first proxy. The first proxy has rsc.io/quote, but that module doesn't contain the package rsc.io/quote/v3.
The go command should fall back to the next proxy in this case since it didn't find the package and didn't receive a terminal error from the proxy. Instead, modload.PackageNotInModuleError is treated as a terminal error, and the go command gives up without going to the next proxy.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
GOPROXY environment variable may contain list of proxy URLs, that should be tried in turn. I found edge case, where multiple proxies are handled incorrectly.
What did you expect to see?
go get downloading rsc.io/quote/v3 module from the second proxy.
What did you see instead?
go get command is downloading rsc.io/quote module from the first proxy and failing with error.
The text was updated successfully, but these errors were encountered: