diff options
author | Bryan C. Mills <bcmills@google.com> | 2018-08-08 10:38:19 -0400 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2018-08-09 19:51:47 +0000 |
commit | a618efd7d8b1c93ad2b8107bed4dd894198e02b1 (patch) | |
tree | 8e6c989f902598a3c10f1fb3d8197468fa406713 | |
parent | 8c0fd83f72d0f8804001aeab52489130cb33b90a (diff) | |
download | go-a618efd7d8b1c93ad2b8107bed4dd894198e02b1.tar.gz go-a618efd7d8b1c93ad2b8107bed4dd894198e02b1.zip |
cmd/go: add test for 'go get' within a local module
Change-Id: I16d36c8e22c84a3266520d86e41ff71ef826ae70
Reviewed-on: https://go-review.googlesource.com/128555
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
-rw-r--r-- | src/cmd/go/testdata/script/mod_get_local.txt | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/mod_get_local.txt b/src/cmd/go/testdata/script/mod_get_local.txt new file mode 100644 index 0000000000..5d2b6cd356 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_get_local.txt @@ -0,0 +1,61 @@ +# Test 'go get' with a local module with a name that is not valid for network lookup. + +env GO111MODULE=on +go mod edit -fmt +cp go.mod go.mod.orig + +# 'go get -u -m' within the main module should work, even if it has a local-only name. +cp go.mod.orig go.mod +go get -u -m +grep 'rsc.io/quote.*v1.5.2' go.mod +grep 'golang.org/x/text.*v0.3.0' go.mod +cp go.mod go.mod.implicitmod + +# 'go get -u -m' with the name of the main module should be equivalent to +# 'go get -u -m' without any further arguments. +cp go.mod.orig go.mod +go get -u -m local +cmp go.mod go.mod.implicitmod + +# 'go get -u -d' in the empty root of the main module should update the +# dependencies of all packages in the module. +cp go.mod.orig go.mod +go get -u -d +cmp go.mod go.mod.implicitmod + +# 'go get -u -d .' within a package in the main module updates all dependencies +# of the main module. +# TODO: Determine whether that behavior is a bug. +# (https://golang.org/issue/26902) +cp go.mod.orig go.mod +cd uselang +go get -u -d . +cd .. +grep 'rsc.io/quote.*v1.5.2' go.mod +grep 'golang.org/x/text.*v0.3.0' go.mod +cp go.mod go.mod.dotpkg + +# BUG: 'go get -u -d' with an explicit package in a local-only package fails. +# TODO: Determine the correct behavior. +# (https://golang.org/issue/26902) +cp go.mod.orig go.mod +! go get -u -d local/uselang +stderr 'missing dot in first path element' +cmp go.mod go.mod.orig + + +-- go.mod -- +module local + +require ( + golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c + rsc.io/quote v1.3.0 +) + +-- uselang/uselang.go -- +package uselang +import _ "golang.org/x/text/language" + +-- usequote/usequote.go -- +package usequote +import _ "rsc.io/quote" |