...

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

Documentation: cmd/go/testdata/script

     1# In GOPATH mode, module legacy support does path rewriting very similar to vendoring.
     2
     3env GO111MODULE=off
     4
     5go list -f '{{range .Imports}}{{.}}{{"\n"}}{{end}}' old/p1
     6stdout ^new/p1$
     7
     8go list -f '{{range .Imports}}{{.}}{{"\n"}}{{end}}' new/p1
     9stdout ^new/p2$           # not new/v2/p2
    10! stdout ^new/v2
    11stdout ^new/sub/x/v1/y$   # not new/sub/v2/x/v1/y
    12! stdout ^new/sub/v2
    13stdout ^new/sub/inner/x # not new/sub/v2/inner/x
    14
    15go build old/p1 new/p1
    16
    17-- new/go.mod --
    18module "new/v2"
    19-- new/new.go --
    20package new
    21
    22import _ "new/v2/p2"
    23-- new/p1/p1.go --
    24package p1
    25
    26import _ "old/p2"
    27import _ "new/v2"
    28import _ "new/v2/p2"
    29import _ "new/sub/v2/x/v1/y" // v2 is module, v1 is directory in module
    30import _ "new/sub/inner/x"   // new/sub/inner/go.mod overrides new/sub/go.mod
    31-- new/p2/p2.go --
    32package p2
    33-- new/sub/go.mod --
    34module new/sub/v2
    35-- new/sub/inner/go.mod --
    36module new/sub/inner
    37-- new/sub/inner/x/x.go --
    38package x
    39-- new/sub/x/v1/y/y.go --
    40package y
    41-- old/p1/p1.go --
    42package p1
    43
    44import _ "old/p2"
    45import _ "new/p1"
    46import _ "new"
    47-- old/p2/p2.go --
    48package p2

View as plain text