1 env GO111MODULE=on
2 [!symlink] skip
3
4 # 'go get' should resolve modules of imported packages.
5 go get
6 go list -deps -f '{{.Module}}' .
7 stdout golang.org/x/text
8
9 go get ./subpkg
10 go list -deps -f '{{.Module}}' ./subpkg
11 stdout golang.org/x/text
12
13 # Create a copy of the module using symlinks in src/links.
14 mkdir links
15 symlink links/go.mod -> $GOPATH/src/go.mod
16 symlink links/go.sum -> $GOPATH/src/go.sum
17 symlink links/issue.go -> $GOPATH/src/issue.go
18 mkdir links/subpkg
19 symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go
20
21 # We should see the copy as a valid module root.
22 cd links
23 go env GOMOD
24 stdout links[/\\]go.mod
25 go list -m
26 stdout golang.org/issue/28107
27
28 # The symlink-based copy should contain the same packages
29 # and have the same dependencies as the original.
30 go list -deps -f '{{.Module}}' .
31 stdout golang.org/x/text
32 go list -deps -f '{{.Module}}' ./subpkg
33 stdout golang.org/x/text
34
35 -- go.mod --
36 module golang.org/issue/28107
37
38 -- issue.go --
39 package issue
40
41 import _ "golang.org/x/text/language"
42 -- subpkg/issue.go --
43 package issue
44
45 import _ "golang.org/x/text/language"
46
View as plain text