Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: handle wildcards for unknown modules in "go get"
For example, "go get golang.org/x/tools/cmd/..." will add a requirement for "golang.org/x/tools" to go.mod and will install executables from the "cmd" subdirectory. Fixes #29363 Change-Id: Id53f051710708d7760ffe831d4274fd54533d2b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/171138 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
- Loading branch information
Jay Conrod
committed
Apr 16, 2019
1 parent
75308c9
commit 6997671
Showing
3 changed files
with
119 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
env GO111MODULE=on | ||
|
||
# If a pattern doesn't match any modules in the build list, | ||
# and -m is used, an error should be reported. | ||
cp go.mod.orig go.mod | ||
! go get -m rsc.io/quote/... | ||
stderr 'pattern matches no modules in build list' | ||
|
||
# If a pattern doesn't match any modules in the build list, | ||
# we assume the pattern matches a single module where the | ||
# part of the pattern before "..." is the module path. | ||
cp go.mod.orig go.mod | ||
go get -d rsc.io/quote/... | ||
grep 'require rsc.io/quote' go.mod | ||
|
||
cp go.mod.orig go.mod | ||
! go get -d rsc.io/quote/x... | ||
stderr 'go get rsc.io/quote/x...: no matching packages in module rsc.io/quote@v1.5.2' | ||
! grep 'require rsc.io/quote' go.mod | ||
|
||
! go get -d rsc.io/quote/x/... | ||
stderr 'go get rsc.io/quote/x/...: no matching packages in module rsc.io/quote@v1.5.2' | ||
! grep 'require rsc.io/quote' go.mod | ||
|
||
-- go.mod.orig -- | ||
module m | ||
|
||
go 1.13 | ||
|
||
-- use/use.go -- | ||
package use | ||
|
||
import _ "rsc.io/quote" |