aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_outside.txt
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-10-22 16:49:04 -0400
committerJay Conrod <jayconrod@google.com>2019-10-22 21:34:48 +0000
commitb2ea4e6d345652f44595c038301720344350b459 (patch)
tree1c1ebc2a4c19f5e6a73828887e3e783265498b8c /src/cmd/go/testdata/script/mod_outside.txt
parent7d891d5e4d7bd7d22b6adcc51e10c9be01825c16 (diff)
downloadgo-b2ea4e6d345652f44595c038301720344350b459.tar.gz
go-b2ea4e6d345652f44595c038301720344350b459.zip
cmd/go: make 'go mod verify' report an error outside a module
Also, test that 'go mod download' without arguments reports an error. Fixes #32027 Change-Id: I873fc59fba4c78ee2b4f49f0d846ee2ac0eee4db Reviewed-on: https://go-review.googlesource.com/c/go/+/202697 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/testdata/script/mod_outside.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_outside.txt13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt
index 815745e8bf..6f569ca351 100644
--- a/src/cmd/go/testdata/script/mod_outside.txt
+++ b/src/cmd/go/testdata/script/mod_outside.txt
@@ -82,6 +82,10 @@ stderr 'cannot find main module'
stderr 'cannot find main module'
+# 'go mod download' without arguments should report an error.
+! go mod download
+stderr 'no modules specified'
+
# 'go mod download' should download exactly the requested module without dependencies.
rm -r $GOPATH/pkg/mod/cache/download/example.com
go mod download example.com/printversion@v1.0.0
@@ -92,15 +96,16 @@ exists $GOPATH/pkg/mod/cache/download/example.com/printversion/@v/v1.0.0.zip
! go mod download all
stderr 'go: cannot match "all": working directory is not part of a module'
+
# 'go mod vendor' should fail: it starts by clearing the existing vendor
# directory, and we don't know where that is.
! go mod vendor
stderr 'cannot find main module'
-# 'go mod verify' should succeed: we have no modules to verify.
-go mod verify
-stdout 'all modules verified'
-! stderr .
+
+# 'go mod verify' should fail: we have no modules to verify.
+! go mod verify
+stderr 'cannot find main module'
# 'go get' without arguments implicitly operates on the main module, and thus