forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: query each path only once in 'go get'
If we don't know whether a path is a module path or a package path, previously we would first try a module query for it, then fall back to a package query. If we are using a sequence of proxies with fallback (as will be the default in Go 1.13), and the path is not actually a module path, that initial module query will fail against the first proxy, then immediately fall back to the next proxy in the sequence — even if the query could have been satisfied by some other (prefix) module available from the first proxy. Instead, we now query the requested path as only one kind of path. If we query it as a package path but it turns out to only exist as a module, we can detect that as a PackageNotInModuleError with an appropriate module path — we do not need to issue a second query to classify it. Fixes golang#31785 Change-Id: I581d44279196e41d1fed27ec25489e75d62654e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/189517 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Bryan C. Mills
committed
Aug 9, 2019
1 parent
1dc0110
commit 2b8b34a
Showing
6 changed files
with
66 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
env GO111MODULE=on | ||
|
||
[!net] skip | ||
|
||
env GOPROXY=https://proxy.golang.org,direct | ||
env GOSUMDB=off | ||
|
||
go get -x -v -d golang.org/x/tools/cmd/goimports | ||
stderr '# get https://proxy.golang.org/golang.org/x/tools/@latest' | ||
! stderr '# get https://golang.org' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
env GO111MODULE=on | ||
|
||
# Download modules to avoid stderr chatter | ||
go mod download [email protected] | ||
go mod download example.com/newcycle/[email protected] | ||
go mod download example.com/newcycle/[email protected] | ||
go mod download example.com/newcycle/[email protected] | ||
|
@@ -10,5 +11,6 @@ go mod init m | |
cmp stderr stderr-expected | ||
|
||
-- stderr-expected -- | ||
go: finding example.com/newcycle v1.0.0 | ||
go get: inconsistent versions: | ||
example.com/newcycle/[email protected] requires example.com/newcycle/[email protected] (not example.com/newcycle/[email protected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ env dbname=localhost.localdev/sumdb | |
cp go.mod.orig go.mod | ||
env GOSUMDB=$sumdb' '$proxy/sumdb-wrong | ||
! go get -d rsc.io/quote | ||
stderr 'verifying rsc.io/[email protected]/go.mod: checksum mismatch' | ||
stderr 'downloaded: h1:LzX7' | ||
stderr 'verifying rsc.io/[email protected]: checksum mismatch' | ||
stderr 'downloaded: h1:3fEy' | ||
stderr 'localhost.localdev/sumdb: h1:wrong' | ||
stderr 'SECURITY ERROR\nThis download does NOT match the one reported by the checksum server.' | ||
! go get -d rsc.io/sampler | ||
|