cmd/doc: understand vendor directories in module mode

This change employs the same strategy as in CL 203017
to detect when vendoring is in use, and if so treats
the vendor directory as a (non-module, prefixless) root.

The integration test also verifies that the 'std' and 'cmd'
modules are included and their vendored dependencies are
visible (as they are with 'go list') even when outside of
those modules.

Fixes #35224

Change-Id: I18cd01218e9eb97c1fc6e2401c1907536b0b95f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/205577
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Bryan C. Mills 2019-10-31 10:03:54 -04:00
parent a2b1dc863f
commit 3c2979682d
3 changed files with 136 additions and 9 deletions

View file

@ -27,7 +27,10 @@ func TestMain(m *testing.M) {
if err != nil {
panic(err)
}
dirsInit(Dir{"testdata", testdataDir}, Dir{"testdata/nested", filepath.Join(testdataDir, "nested")}, Dir{"testdata/nested/nested", filepath.Join(testdataDir, "nested", "nested")})
dirsInit(
Dir{importPath: "testdata", dir: testdataDir},
Dir{importPath: "testdata/nested", dir: filepath.Join(testdataDir, "nested")},
Dir{importPath: "testdata/nested/nested", dir: filepath.Join(testdataDir, "nested", "nested")})
os.Exit(m.Run())
}