github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/cmd/go/testdata/script/list_importmap.txt (about)

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