...
1env 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.
8go list -f '{{.ImportPath}}: {{.ImportMap}}' fmt a/b
9stdout 'fmt: map\[\]'
10stdout '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
15go list -deps -test -f '{{.ImportPath}} MAP: {{.ImportMap}}{{"\n"}}{{.ImportPath}} IMPORT: {{.Imports}}' fmt
16stdout '^flag \[fmt\.test\] MAP: map\[fmt:fmt \[fmt\.test\]\]'
17stdout '^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]'
18! stdout '^fmt\.test MAP: map\[(.* )?os:'
19stdout '^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 --
23package b
24
25import _ "c/d"
26-- a/vendor/c/d/d.go --
27package d
View as plain text