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

     1  env GO111MODULE=off
     2  
     3  # gccgo does not have standard packages.
     4  [compiler:gccgo] skip
     5  
     6  # fmt should have no rewritten imports.
     7  # The import from a/b should map c/d to a's vendor directory.
     8  go list -f '{{.ImportPath}}: {{.ImportMap}}' fmt a/b
     9  stdout 'fmt: map\[\]'
    10  stdout 'a/b: map\[c/d:a/vendor/c/d\]'
    11  
    12  # flag [fmt.test] should import fmt [fmt.test] as fmt
    13  # fmt.test should import testing [fmt.test] as testing
    14  # fmt.test should not import a modified os
    15  go list -deps -test -f '{{.ImportPath}} MAP: {{.ImportMap}}{{"\n"}}{{.ImportPath}} IMPORT: {{.Imports}}' fmt
    16  stdout '^flag \[fmt\.test\] MAP: map\[fmt:fmt \[fmt\.test\]\]'
    17  stdout '^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]'
    18  ! stdout '^fmt\.test MAP: map\[(.* )?os:'
    19  stdout '^fmt\.test IMPORT: \[fmt \[fmt\.test\] fmt_test \[fmt\.test\] os reflect testing \[fmt\.test\] testing/internal/testdeps \[fmt\.test\]\]'
    20  
    21  
    22  -- a/b/b.go --
    23  package b
    24  
    25  import _ "c/d"
    26  -- a/vendor/c/d/d.go --
    27  package d
    28  

View as plain text