diff options
author | Jay Conrod <jayconrod@google.com> | 2020-09-02 13:14:36 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2020-09-15 12:45:59 +0000 |
commit | e3063636124d0e5b2d0fad7912a9c6810629f486 (patch) | |
tree | c339aa42681b4455f4db8e72bc90ee5c19f6d719 /src/cmd/go/testdata/script/mod_outside.txt | |
parent | ea33523877e4c7a136f2db94a8b5bc4e40220be2 (diff) | |
download | go-e3063636124d0e5b2d0fad7912a9c6810629f486.tar.gz go-e3063636124d0e5b2d0fad7912a9c6810629f486.zip |
cmd/go: implement 'go install pkg@version'
With this change, 'go install' will install executables in module mode
without using or modifying the module in the current directory, if
there is one.
For #40276
Change-Id: I922e71719b3a4e0c779ce7a30429355fc29930bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/254365
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/testdata/script/mod_outside.txt')
-rw-r--r-- | src/cmd/go/testdata/script/mod_outside.txt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt index 03ef576168..2001c45c3c 100644 --- a/src/cmd/go/testdata/script/mod_outside.txt +++ b/src/cmd/go/testdata/script/mod_outside.txt @@ -177,9 +177,11 @@ go doc fmt ! go doc example.com/version stderr 'doc: cannot find module providing package example.com/version: working directory is not part of a module' -# 'go install' with a version should fail due to syntax. -! go install example.com/printversion@v1.0.0 -stderr 'can only use path@version syntax with' +# 'go install' with a version should succeed if all constraints are met. +# See mod_install_pkg_version. +rm $GOPATH/bin +go install example.com/printversion@v0.1.0 +exists $GOPATH/bin/printversion$GOEXE # 'go install' should fail if a package argument must be resolved to a module. ! go install example.com/printversion |