diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
commit | a16e30d162c1c7408db7821e7b9513cefa09c6ca (patch) | |
tree | af752ba9ba44c547df39bb0af9bff79f610ba9d5 /src/cmd/go/testdata/script/mod_readonly.txt | |
parent | 91e4d2d57bc341dd82c98247117114c851380aef (diff) | |
parent | cf6cfba4d5358404dd890f6025e573a4b2156543 (diff) | |
download | go-a16e30d162c1c7408db7821e7b9513cefa09c6ca.tar.gz go-a16e30d162c1c7408db7821e7b9513cefa09c6ca.zip |
[dev.link] all: merge branch 'master' into dev.linkdev.link
Clean merge.
Change-Id: Ia7b2808bc649790198d34c226a61d9e569084dc5
Diffstat (limited to 'src/cmd/go/testdata/script/mod_readonly.txt')
-rw-r--r-- | src/cmd/go/testdata/script/mod_readonly.txt | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/cmd/go/testdata/script/mod_readonly.txt b/src/cmd/go/testdata/script/mod_readonly.txt index a8458fdea3..f2c77de806 100644 --- a/src/cmd/go/testdata/script/mod_readonly.txt +++ b/src/cmd/go/testdata/script/mod_readonly.txt @@ -13,7 +13,7 @@ cmp go.mod go.mod.empty # -mod=readonly should be set by default. env GOFLAGS= ! go list all -stderr '^x.go:2:8: cannot find module providing package rsc\.io/quote$' +stderr '^x.go:2:8: no required module provides package rsc\.io/quote; try ''go mod tidy'' to add it$' cmp go.mod go.mod.empty env GOFLAGS=-mod=readonly @@ -41,7 +41,8 @@ go list -m all # -mod=readonly should reject inconsistent go.mod files # (ones that would be rewritten). -go mod edit -require rsc.io/sampler@v1.2.0 +go get -d rsc.io/sampler@v1.2.0 +go mod edit -require rsc.io/quote@v1.5.2 cp go.mod go.mod.inconsistent ! go list stderr 'go: updates to go.mod needed, disabled by -mod=readonly' @@ -68,6 +69,23 @@ cp go.mod.indirect go.mod go list all cmp go.mod go.mod.indirect + +# If we identify a missing package as a dependency of some other package in the +# main module, we should suggest 'go mod tidy' instead of resolving it. + +cp go.mod.untidy go.mod +! go list all +stderr '^x.go:2:8: no required module provides package rsc.io/quote; try ''go mod tidy'' to add it$' + +! go list -deps . +stderr '^x.go:2:8: no required module provides package rsc.io/quote; try ''go mod tidy'' to add it$' + +# However, if we didn't see an import from the main module, we should suggest +# 'go get -d' instead, because we don't know whether 'go mod tidy' would add it. +! go list rsc.io/quote +stderr '^no required module provides package rsc.io/quote; try ''go get -d rsc.io/quote'' to add it$' + + -- go.mod -- module m @@ -103,3 +121,11 @@ require ( rsc.io/sampler v1.3.0 // indirect rsc.io/testonly v1.0.0 // indirect ) +-- go.mod.untidy -- +module m + +go 1.20 + +require ( + rsc.io/sampler v1.3.0 // indirect +) |