Skip to content

Commit 03a6860

Browse files
author
Jay Conrod
committed
cmd/go: update tests to work with -mod=readonly on by default
For #40728 Change-Id: Ic2b025ff75c6e73c0cb58c1737e44e2a41c71571 Reviewed-on: https://go-review.googlesource.com/c/go/+/253837 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
1 parent d277a36 commit 03a6860

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+146
-76
lines changed

src/cmd/go/testdata/mod/example.com_retract_missingmod_v1.0.0.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ module example.com/retract/missingmod
66
go 1.14
77
-- .info --
88
{"Version":"v1.0.0"}
9+
-- missingmod.go --
10+
package missingmod

src/cmd/go/testdata/script/mod_auth.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env GOSUMDB=off
77
# Without credentials, downloading a module from a path that requires HTTPS
88
# basic auth should fail.
99
env NETRC=$WORK/empty
10-
! go list all
10+
! go mod tidy
1111
stderr '^\tserver response: ACCESS DENIED, buddy$'
1212
stderr '^\tserver response: File\? What file\?$'
1313

src/cmd/go/testdata/script/mod_case.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
env GO111MODULE=on
22

3-
go get rsc.io/QUOTE
3+
go get -d
44
go list -m all
55
stdout '^rsc.io/quote v1.5.2'
66
stdout '^rsc.io/QUOTE v1.5.2'
@@ -18,3 +18,8 @@ stdout '[email protected]!p!r!e'
1818

1919
-- go.mod --
2020
module x
21+
22+
-- use.go --
23+
package use
24+
25+
import _ "rsc.io/QUOTE/QUOTE"

src/cmd/go/testdata/script/mod_concurrent.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
env GO111MODULE=on
22

33
# Concurrent builds should succeed, even if they need to download modules.
4+
go get -d ./x ./y
45
go build ./x &
56
go build ./y
67
wait

src/cmd/go/testdata/script/mod_doc.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# go doc should find module documentation
22

33
env GO111MODULE=on
4+
env GOFLAGS=-mod=mod
45
[short] skip
56

67
# Check when module x is inside GOPATH/src.
@@ -48,6 +49,7 @@ stderr '^doc: cannot find module providing package example.com/hello: module loo
4849
# path used in source code, not to the absolute path relative to GOROOT.
4950

5051
cd $GOROOT/src
52+
env GOFLAGS=
5153
go doc cryptobyte
5254
stdout '// import "golang.org/x/crypto/cryptobyte"'
5355

src/cmd/go/testdata/script/mod_domain_root.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# (example.com not example.com/something)
33

44
env GO111MODULE=on
5-
go build
5+
go get -d
66

77
-- go.mod --
88
module x

src/cmd/go/testdata/script/mod_download.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ go mod edit -require rsc.io/[email protected]
4646
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
4747

4848
# module loading will page in the info and mod files
49-
go list -m all
49+
go list -m -mod=mod all
5050
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.info
5151
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.mod
5252
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip

src/cmd/go/testdata/script/mod_download_partial.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Download a module
2-
go mod download -modcacherw rsc.io/quote
1+
# Download modules and populate go.sum.
2+
go get -d -modcacherw
33
exists $GOPATH/pkg/mod/rsc.io/[email protected]/go.mod
44

55
# 'go mod verify' should fail if we delete a file.
@@ -61,4 +61,9 @@ go 1.14
6161

6262
require rsc.io/quote v1.5.2
6363

64+
-- use.go --
65+
package use
66+
67+
import _ "rsc.io/quote"
68+
6469
-- empty --

src/cmd/go/testdata/script/mod_get_incompatible.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
env GO111MODULE=on
22

3-
go list x
3+
go get -d x
44
go list -m all
55
stdout 'rsc.io/breaker v2.0.0\+incompatible'
66

src/cmd/go/testdata/script/mod_get_indirect.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ grep 'golang.org/x/text v0.3.0 // indirect$' go.mod
2727

2828
# indirect tag should be removed upon seeing direct import.
2929
cp $WORK/tmp/uselang.go x.go
30-
go list
30+
go get -d
3131
grep 'rsc.io/quote v1.5.2$' go.mod
3232
grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
3333

0 commit comments

Comments
 (0)