]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: prefer 'go get -d' instead of 'go get' in script tests
authorBryan C. Mills <bcmills@google.com>
Thu, 5 Nov 2020 17:59:16 +0000 (12:59 -0500)
committerBryan C. Mills <bcmills@google.com>
Mon, 9 Nov 2020 17:38:46 +0000 (17:38 +0000)
'get -d' has somewhat narrower semantics and is generally faster.
We're deprecating the non-'-d' mode in CL 266360.

For #26472

Change-Id: Id4a324771f77b83e5f47043fd50b74e1c062390b
Reviewed-on: https://go-review.googlesource.com/c/go/+/267883
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
21 files changed:
src/cmd/go/testdata/script/get_go_file.txt
src/cmd/go/testdata/script/mod_case.txt
src/cmd/go/testdata/script/mod_case_cgo.txt
src/cmd/go/testdata/script/mod_get_commit.txt
src/cmd/go/testdata/script/mod_get_downgrade.txt
src/cmd/go/testdata/script/mod_get_downgrade_missing.txt
src/cmd/go/testdata/script/mod_get_incompatible.txt
src/cmd/go/testdata/script/mod_get_moved.txt
src/cmd/go/testdata/script/mod_get_none.txt
src/cmd/go/testdata/script/mod_get_sum_noroot.txt
src/cmd/go/testdata/script/mod_get_test.txt
src/cmd/go/testdata/script/mod_get_upgrade.txt
src/cmd/go/testdata/script/mod_gonoproxy.txt
src/cmd/go/testdata/script/mod_gopkg_unstable.txt
src/cmd/go/testdata/script/mod_issue35317.txt
src/cmd/go/testdata/script/mod_proxy_list.txt
src/cmd/go/testdata/script/mod_readonly.txt
src/cmd/go/testdata/script/mod_tidy_replace.txt
src/cmd/go/testdata/script/mod_vendor_auto.txt
src/cmd/go/testdata/script/mod_vendor_build.txt
src/cmd/go/testdata/script/vendor_list_issue11977.txt

index 97e0f1ac9262764e079998e111a024b94b52560c..bed872098769249e851a30ac13a4957c83aed913 100644 (file)
@@ -5,46 +5,46 @@
 env GO111MODULE=off
 
 # argument doesn't have .go suffix
-go get test
+go get -d test
 
 # argument has .go suffix, is a file and exists
-! go get test.go
+! go get -d test.go
 stderr 'go get test.go: arguments must be package or module paths'
 
 # argument has .go suffix, doesn't exist and has no slashes
-! go get test_missing.go
+! go get -d test_missing.go
 stderr 'go get test_missing.go: arguments must be package or module paths'
 
 # argument has .go suffix, is a file and exists in sub-directory
-! go get test/test.go
+! go get -d test/test.go
 stderr 'go get: test/test.go exists as a file, but ''go get'' requires package arguments'
 
 # argument has .go suffix, doesn't exist and has slashes
-! go get test/test_missing.go
+! go get -d test/test_missing.go
 ! stderr 'arguments must be package or module paths'
 ! stderr 'exists as a file, but ''go get'' requires package arguments'
 
 # argument has .go suffix, is a symlink and exists
 [symlink] symlink test_sym.go -> test.go
-[symlink] ! go get test_sym.go
+[symlink] ! go get -d test_sym.go
 [symlink] stderr 'go get test_sym.go: arguments must be package or module paths'
 [symlink] rm test_sym.go
 
 # argument has .go suffix, is a symlink and exists in sub-directory
 [symlink] symlink test/test_sym.go -> test.go
-[symlink] ! go get test/test_sym.go
+[symlink] ! go get -d test/test_sym.go
 [symlink] stderr 'go get: test/test_sym.go exists as a file, but ''go get'' requires package arguments'
 [symlink] rm test_sym.go
 
 # argument has .go suffix, is a directory and exists
 mkdir test_dir.go
-! go get test_dir.go
+! go get -d test_dir.go
 stderr 'go get test_dir.go: arguments must be package or module paths'
 rm test_dir.go
 
 # argument has .go suffix, is a directory and exists in sub-directory
 mkdir test/test_dir.go
-! go get test/test_dir.go
+! go get -d test/test_dir.go
 ! stderr 'arguments must be package or module paths'
 ! stderr 'exists as a file, but ''go get'' requires package arguments'
 rm test/test_dir.go
index 6f8d869c447c8ee99a30c0ce8945f1c2744f1424..4a4698600f7fb965162272a5eb7df75919712bc0 100644 (file)
@@ -9,7 +9,7 @@ go list -f 'DIR {{.Dir}} DEPS {{.Deps}}' rsc.io/QUOTE/QUOTE
 stdout 'DEPS.*rsc.io/quote'
 stdout 'DIR.*!q!u!o!t!e'
 
-go get rsc.io/QUOTE@v1.5.3-PRE
+go get -d rsc.io/QUOTE@v1.5.3-PRE
 go list -m all
 stdout '^rsc.io/QUOTE v1.5.3-PRE'
 
index 917bce92d8844fcee0d056b58aefb1392753c0e7..f3d6aaa5abc77bc02d61faed05e242de12cb5476 100644 (file)
@@ -2,7 +2,9 @@
 
 env GO111MODULE=on
 
-go get rsc.io/CGO
+go get -d rsc.io/CGO
+[short] stop
+
 go build rsc.io/CGO
 
 -- go.mod --
index 857740ae6cb12d1410f6d7d1a4fa7cf89cdbc5ef..4649491a532a8c7a8b20c88fde9aa16ca7b751be 100644 (file)
@@ -32,11 +32,11 @@ go install -x golang.org/x/text/language
 ! go get -d -x golang.org/x/text/foo@14c0d48
 
 # get pseudo-version should record that version
-go get rsc.io/quote@v0.0.0-20180214005840-23179ee8a569
+go get -d rsc.io/quote@v0.0.0-20180214005840-23179ee8a569
 grep 'rsc.io/quote v0.0.0-20180214005840-23179ee8a569' go.mod
 
 # but as commit should record as v1.5.1
-go get rsc.io/quote@23179ee8
+go get -d rsc.io/quote@23179ee8
 grep 'rsc.io/quote v1.5.1' go.mod
 
 # go mod edit -require does not interpret commits
index 77dad2b3853fcfdf73f121ae6d5418c66e8f7df8..a954c10344bbafd33266e59c8efb4bb0a2115db3 100644 (file)
@@ -3,31 +3,33 @@ env GO111MODULE=on
 
 # downgrade sampler should downgrade quote
 cp go.mod.orig go.mod
-go get rsc.io/sampler@v1.0.0
+go get -d rsc.io/sampler@v1.0.0
 go list -m all
 stdout 'rsc.io/quote v1.4.0'
 stdout 'rsc.io/sampler v1.0.0'
 
 # downgrade sampler away should downgrade quote further
-go get rsc.io/sampler@none
+go get -d rsc.io/sampler@none
 go list -m all
 stdout 'rsc.io/quote v1.3.0'
 
 # downgrade should report inconsistencies and not change go.mod
-go get rsc.io/quote@v1.5.1
+go get -d rsc.io/quote@v1.5.1
 go list -m all
 stdout 'rsc.io/quote v1.5.1'
 stdout 'rsc.io/sampler v1.3.0'
-! go get rsc.io/sampler@v1.0.0 rsc.io/quote@v1.5.2 golang.org/x/text@none
+
+! go get -d rsc.io/sampler@v1.0.0 rsc.io/quote@v1.5.2 golang.org/x/text@none
 stderr '^go get: rsc.io/quote@v1.5.2 requires rsc.io/sampler@v1.3.0, not rsc.io/sampler@v1.0.0$'
 stderr '^go get: rsc.io/quote@v1.5.2 requires golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c, not golang.org/x/text@none$'
+
 go list -m all
 stdout 'rsc.io/quote v1.5.1'
 stdout 'rsc.io/sampler v1.3.0'
 
 # go get -u args should limit upgrades
 cp go.mod.empty go.mod
-go get -u rsc.io/quote@v1.4.0 rsc.io/sampler@v1.0.0
+go get -d -u rsc.io/quote@v1.4.0 rsc.io/sampler@v1.0.0
 go list -m all
 stdout 'rsc.io/quote v1.4.0'
 stdout 'rsc.io/sampler v1.0.0'
@@ -38,7 +40,7 @@ stdout 'rsc.io/sampler v1.0.0'
 cp go.mod.orig go.mod
 go list -m -versions example.com/latemigrate/v2
 stdout v2.0.0 # proxy may serve incompatible versions
-go get rsc.io/quote@none
+go get -d rsc.io/quote@none
 go list -m all
 ! stdout 'example.com/latemigrate/v2'
 
index f1167fb578a1320903baf2e0cef8b82d4e877a2a..5b768faeb1802c7ffca5389a0eb74d34aa7418db 100644 (file)
@@ -4,7 +4,7 @@ cp go.mod go.mod.orig
 # not yet present in that module should report the version mismatch
 # rather than a "matched no packages" warning.
 
-! go get example.net/pkgadded@v1.1.0 example.net/pkgadded/subpkg/...
+! go get -d example.net/pkgadded@v1.1.0 example.net/pkgadded/subpkg/...
 stderr '^go get: example.net/pkgadded@v1.1.0 conflicts with example.net/pkgadded/subpkg/...@upgrade \(v1.2.0\)$'
 ! stderr 'matched no packages'
 cmp go.mod.orig go.mod
@@ -12,7 +12,7 @@ cmp go.mod.orig go.mod
 
 # A wildcard pattern should match the pattern with that path.
 
-go get example.net/pkgadded/...@v1.0.0
+go get -d example.net/pkgadded/...@v1.0.0
 go list -m all
 stdout '^example.net/pkgadded v1.0.0'
 cp go.mod.orig go.mod
@@ -22,12 +22,12 @@ cp go.mod.orig go.mod
 # and another argument constrains away the version that provides that
 # package, then 'go get' should fail with a useful error message.
 
-! go get example.net/pkgadded@v1.0.0 .
+! go get -d example.net/pkgadded@v1.0.0 .
 stderr '^example.com/m imports\n\texample.net/pkgadded/subpkg: cannot find module providing package example.net/pkgadded/subpkg$'
 ! stderr 'example.net/pkgadded v1\.2\.0'
 cmp go.mod.orig go.mod
 
-go get example.net/pkgadded@v1.0.0
+go get -d example.net/pkgadded@v1.0.0
 ! go list -deps -mod=readonly .
 stderr '^m.go:3:8: cannot find module providing package example\.net/pkgadded/subpkg: '
 
index b28718a6946f77ee828f1a63e3f59b09dcf29f14..8000ee61481a01be883b022d17001ed2301f2a6b 100644 (file)
@@ -5,11 +5,11 @@ go list -m all
 stdout 'rsc.io/breaker v2.0.0\+incompatible'
 
 cp go.mod2 go.mod
-go get rsc.io/breaker@7307b30
+go get -d rsc.io/breaker@7307b30
 go list -m all
 stdout 'rsc.io/breaker v2.0.0\+incompatible'
 
-go get rsc.io/breaker@v2.0.0
+go get -d rsc.io/breaker@v2.0.0
 go list -m all
 stdout 'rsc.io/breaker v2.0.0\+incompatible'
 
index e16c16089091bb39193e54abf076a44feb7240e0..8430a737c40ca00842f14faede5001baa2f81a7e 100644 (file)
@@ -9,7 +9,7 @@ go list -m all
 stdout 'example.com/split v1.0.0'
 
 # A 'go get' that simultaneously upgrades away conflicting package defitions is not ambiguous.
-go get example.com/split/subpkg@v1.1.0
+go get -d example.com/split/subpkg@v1.1.0
 
 # A 'go get' without an upgrade should find the package.
 rm go.mod
@@ -30,7 +30,7 @@ stdout 'example.com/join/subpkg v1.0.0'
 # A 'go get' that simultaneously upgrades away conflicting package definitions is not ambiguous.
 # (A wildcard pattern applies to both packages and modules,
 # because we define wildcard matching to apply after version resolution.)
-go get example.com/join/subpkg/...@v1.1.0
+go get -d example.com/join/subpkg/...@v1.1.0
 
 # A 'go get' without an upgrade should find the package.
 rm go.mod
index 5aec209f59fe6fa54ffa3f67ce9d31d73fb665de..b358f05af36745226e909e1f4a81154bbf6fcdae 100644 (file)
@@ -3,10 +3,10 @@ env GO111MODULE=on
 go mod init example.com/foo
 
 # 'go get bar@none' should be a no-op if module bar is not active.
-go get example.com/bar@none
+go get -d example.com/bar@none
 go list -m all
 ! stdout example.com/bar
 
-go get example.com/bar@none
+go get -d example.com/bar@none
 go list -m all
 ! stdout example.com/bar
index 0d9a840e779cc4334544df743213f67ea58b5cc7..4f1cf0327770389511b2fb2da0f7178544cab311 100644 (file)
@@ -2,7 +2,7 @@
 # it should add sums for the module's go.mod file and its content to go.sum.
 # Verifies golang.org/issue/41103.
 go mod init m
-go get rsc.io/QUOTE
+go get -d rsc.io/QUOTE
 grep '^rsc.io/QUOTE v1.5.2/go.mod ' go.sum
 grep '^rsc.io/QUOTE v1.5.2 ' go.sum
 
index 3680ca273d98f20b1dee02333703e1227837e67f..23722bd4e4dcd7f749386b2e68dee7efea25e9a3 100644 (file)
@@ -2,7 +2,7 @@ env GO111MODULE=on
 
 # By default, 'go get' should ignore tests
 cp go.mod.empty go.mod
-go get m/a
+go get -d m/a
 ! grep rsc.io/quote go.mod
 
 # 'go get -t' should consider test dependencies of the named package.
index 6a14dfdc45d6cfda4a397e1b5cfb023c19321751..eeb6d6f6af6f414b5545034bbabf80f9cceec096 100644 (file)
@@ -1,6 +1,6 @@
 env GO111MODULE=on
 
-go get rsc.io/quote@v1.5.1
+go get -d rsc.io/quote@v1.5.1
 go list -m all
 stdout 'rsc.io/quote v1.5.1'
 grep 'rsc.io/quote v1.5.1$' go.mod
index a9e0ca401089170e0a208c719480b4a16c251ec9..7ead946c24a06b7ba2c27649644deda641cfb7f6 100644 (file)
@@ -7,26 +7,26 @@ env dbname=localhost.localdev/sumdb
 # disagree with sumdb fails
 cp go.mod.orig go.mod
 env GOSUMDB=$sumdb' '$proxy/sumdb-wrong
-! go get rsc.io/quote
+! go get -d rsc.io/quote
 stderr 'SECURITY ERROR'
 
 # GONOSUMDB bypasses sumdb, for rsc.io/quote, rsc.io/sampler, golang.org/x/text
 env GONOSUMDB='*/quote,*/*mple*,golang.org/x'
-go get rsc.io/quote
+go get -d rsc.io/quote
 rm go.sum
 env GOPRIVATE='*/quote,*/*mple*,golang.org/x'
 env GONOPROXY=none # that is, proxy all despite GOPRIVATE
-go get rsc.io/quote
+go get -d rsc.io/quote
 
 # When GOPROXY is not empty but contains no entries, an error should be reported.
 env GOPROXY=','
-! go get golang.org/x/text
+! go get -d golang.org/x/text
 stderr '^go get golang.org/x/text: GOPROXY list is not the empty string, but contains no entries$'
 
 # When GOPROXY=off, fetching modules not matched by GONOPROXY fails.
 env GONOPROXY=*/fortune
 env GOPROXY=off
-! go get golang.org/x/text
+! go get -d golang.org/x/text
 stderr '^go get golang.org/x/text: module lookup disabled by GOPROXY=off$'
 
 # GONOPROXY bypasses proxy
@@ -34,13 +34,13 @@ stderr '^go get golang.org/x/text: module lookup disabled by GOPROXY=off$'
 [!exec:git] skip
 env GOPRIVATE=none
 env GONOPROXY='*/fortune'
-! go get rsc.io/fortune # does not exist in real world, only on test proxy
+! go get -d rsc.io/fortune # does not exist in real world, only on test proxy
 stderr 'git ls-remote'
 
 env GOSUMDB=
 env GONOPROXY=
 env GOPRIVATE='*/x'
-go get golang.org/x/text
+go get -d golang.org/x/text
 go list -m all
 ! stdout 'text.*v0.0.0-2017' # should not have the version from the proxy
 
index 9d288a64d455803550c550b649d31b8e6b88fdb1..5ad9106378f33303b82dfad6df2d99bfedb87bee 100644 (file)
@@ -12,7 +12,7 @@ go list
 
 env GOPROXY=direct
 env GOSUMDB=off
-go get gopkg.in/macaroon-bakery.v2-unstable/bakery
+go get -d gopkg.in/macaroon-bakery.v2-unstable/bakery
 go list -m all
 stdout 'gopkg.in/macaroon-bakery.v2-unstable v2.0.0-[0-9]+-[0-9a-f]+$'
 
index 92416a54e474e0a8bb22c6422e1dd2a2fca01154..b1852ab0319ebbccdc6e15b063719332fad938a6 100644 (file)
@@ -5,4 +5,4 @@ env GO111MODULE=on
 [short] skip
 
 go mod init example.com
-go get golang.org/x/text@v0.3.0 golang.org/x/internal@v0.1.0 golang.org/x/exp@none
+go get -d golang.org/x/text@v0.3.0 golang.org/x/internal@v0.1.0 golang.org/x/exp@none
index 849cf2c476406554244339100d1699327f5857aa..89129f4fe237d6440935fd836ac9cacf7c2887f9 100644 (file)
@@ -3,34 +3,34 @@ env proxy=$GOPROXY
 
 # Proxy that can't serve should fail.
 env GOPROXY=$proxy/404
-! go get rsc.io/quote@v1.0.0
+! go get -d rsc.io/quote@v1.0.0
 stderr '404 Not Found'
 
 # get should walk down the proxy list past 404 and 410 responses.
 env GOPROXY=$proxy/404,$proxy/410,$proxy
-go get rsc.io/quote@v1.1.0
+go get -d rsc.io/quote@v1.1.0
 
 # get should not walk past other 4xx errors if proxies are separated with ','.
 env GOPROXY=$proxy/403,$proxy
-! go get rsc.io/quote@v1.2.0
+! go get -d rsc.io/quote@v1.2.0
 stderr 'reading.*/403/rsc.io/.*: 403 Forbidden'
 
 # get should not walk past non-4xx errors if proxies are separated with ','.
 env GOPROXY=$proxy/500,$proxy
-! go get rsc.io/quote@v1.3.0
+! go get -d rsc.io/quote@v1.3.0
 stderr 'reading.*/500/rsc.io/.*: 500 Internal Server Error'
 
 # get should walk past other 4xx errors if proxies are separated with '|'.
 env GOPROXY=$proxy/403|https://0.0.0.0|$proxy
-go get rsc.io/quote@v1.2.0
+go get -d rsc.io/quote@v1.2.0
 
 # get should walk past non-4xx errors if proxies are separated with '|'.
 env GOPROXY=$proxy/500|https://0.0.0.0|$proxy
-go get rsc.io/quote@v1.3.0
+go get -d rsc.io/quote@v1.3.0
 
 # get should return the final error if that's all we have.
 env GOPROXY=$proxy/404,$proxy/410
-! go get rsc.io/quote@v1.4.0
+! go get -d rsc.io/quote@v1.4.0
 stderr 'reading.*/410/rsc.io/.*: 410 Gone'
 
 -- go.mod --
index f2c77de806294fbfe2bb9c7ee89d373dc43819eb..ca8cd6e068938cb64fb372b85b11af1e7eaf8a2e 100644 (file)
@@ -19,7 +19,7 @@ cmp go.mod go.mod.empty
 env GOFLAGS=-mod=readonly
 
 # update go.mod - go get allowed
-go get rsc.io/quote
+go get -d rsc.io/quote
 grep rsc.io/quote go.mod
 
 # update go.mod - go mod tidy allowed
index 7b00bf13842afcdb2c681ea2a57ebe328781171f..dd9943889106568addf3a503a22c478b0dfb8bde 100644 (file)
@@ -35,7 +35,7 @@ grep 'golang.org/x/text' go.mod
 # 'go get' and 'go mod tidy' should follow the requirements of the replacements,
 # not the originals, even if that results in a set of versions that are
 # misleading or redundant without those replacements.
-go get rsc.io/sampler@v1.2.0
+go get -d rsc.io/sampler@v1.2.0
 go mod tidy
 go list -m all
 stdout 'rsc.io/quote/v3 v3.0.0'
index e71db96643a65aeff2b52be486d0ea02d9adf998..1b362eda0bdf0b5cd8b82f55afbb88f34cfd1e91 100644 (file)
@@ -177,7 +177,7 @@ stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$'
 
 # 'go get' should update from the network or module cache,
 # even if a vendor directory is present.
-go get example.com/version@v1.1.0
+go get -d example.com/version@v1.1.0
 ! go list -f {{.Dir}} -tags tools all
 stderr '^go: inconsistent vendoring'
 
index 4efda55e08f10fb391c12324bbd2e52813be9f2b..3b8eec0119b3fd64c23cfd346aab5ecfe2d63b6d 100644 (file)
@@ -10,7 +10,7 @@ stdout rsc.io/sampler
 ! grep 'rsc.io/sampler v1.3.0' go.mod
 
 # update to v1.3.1, now indirect in go.mod.
-go get rsc.io/sampler@v1.3.1
+go get -d rsc.io/sampler@v1.3.1
 grep 'rsc.io/sampler v1.3.1 // indirect' go.mod
 cp go.mod go.mod.good
 
index cdab33c0892bff21c93c41a17d155c711be0eb16..ce2e29f99a7902e0313d58e48353e3aa29c1a086 100644 (file)
@@ -2,7 +2,7 @@
 [!exec:git] skip
 env GO111MODULE=off
 
-go get github.com/rsc/go-get-issue-11864
+go get -d github.com/rsc/go-get-issue-11864
 
 go list -f '{{join .TestImports "\n"}}' github.com/rsc/go-get-issue-11864/t
 stdout 'go-get-issue-11864/vendor/vendor.org/p'