...
1env GO111MODULE=on
2[short] skip
3
4# A 'go get' that worked at a previous version should continue to work at that version,
5# even if the package was subsequently moved into a submodule.
6go mod init example.com/foo
7go get example.com/split/subpkg@v1.0.0
8go list -m all
9stdout 'example.com/split v1.0.0'
10
11# A 'go get' that simultaneously upgrades away conflicting package definitions is not ambiguous.
12go get example.com/split/subpkg@v1.1.0
13
14# A 'go get' without an upgrade should find the package.
15rm go.mod
16go mod init example.com/foo
17go get example.com/split/subpkg
18go list -m all
19stdout 'example.com/split/subpkg v1.1.0'
20
21
22# A 'go get' that worked at a previous version should continue to work at that version,
23# even if the package was subsequently moved into a parent module.
24rm go.mod
25go mod init example.com/foo
26go get example.com/join/subpkg@v1.0.0
27go list -m all
28stdout 'example.com/join/subpkg v1.0.0'
29
30# A 'go get' that simultaneously upgrades away conflicting package definitions is not ambiguous.
31# (A wildcard pattern applies to both packages and modules,
32# because we define wildcard matching to apply after version resolution.)
33go get example.com/join/subpkg/...@v1.1.0
34
35# A 'go get' without an upgrade should find the package.
36rm go.mod
37go mod init example.com/foo
38go get example.com/join/subpkg@v1.1.0
39go list -m all
40stdout 'example.com/join v1.1.0'
View as plain text