...
1env GO111MODULE=on
2[short] skip
3
4# If a pattern doesn't match any packages provided by modules
5# in the build list, we assume the pattern matches a single module
6# whose path is a prefix of the part of the pattern before "...".
7cp go.mod.orig go.mod
8go get rsc.io/quote/...
9grep 'require rsc.io/quote' go.mod
10
11cp go.mod.orig go.mod
12! go get rsc.io/quote/x...
13stderr 'go: module rsc.io/quote@upgrade found \(v1.5.2\), but does not contain packages matching rsc.io/quote/x...'
14! grep 'require rsc.io/quote' go.mod
15
16! go get rsc.io/quote/x/...
17stderr 'go: module rsc.io/quote@upgrade found \(v1.5.2\), but does not contain packages matching rsc.io/quote/x/...'
18! grep 'require rsc.io/quote' go.mod
19
20# If a pattern matches no packages within a module, the module should not
21# be upgraded, even if the module path is a prefix of the pattern.
22cp go.mod.orig go.mod
23go mod edit -require example.com/nest@v1.0.0
24go get example.com/nest/sub/y...
25grep 'example.com/nest/sub v1.0.0' go.mod
26grep 'example.com/nest v1.0.0' go.mod
27
28# However, if the pattern matches the module path itself, the module
29# should be upgraded even if it contains no matching packages.
30go get example.com/n...t
31grep 'example.com/nest v1.1.0' go.mod
32grep 'example.com/nest/sub v1.0.0' go.mod
33
34-- go.mod.orig --
35module m
36
37go 1.13
38
39-- use/use.go --
40package use
41
42import _ "rsc.io/quote"
View as plain text