...

Text file src/cmd/go/testdata/script/mod_symlink.txt

Documentation: cmd/go/testdata/script

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

View as plain text