diff options
| author | Michael Fraenkel <michael.fraenkel@gmail.com> | 2018-05-23 17:23:35 -0400 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2018-06-11 22:09:14 +0000 |
| commit | d0d47bb94fcc018d03f47faa51f981b8902fc7cd (patch) | |
| tree | 0e0514f6ba5d86fe639bfcdf63ab65e35355a821 /src/cmd/doc/doc_test.go | |
| parent | f864d89ef7142687fabcbc28e9058868bce82468 (diff) | |
| download | go-d0d47bb94fcc018d03f47faa51f981b8902fc7cd.tar.xz | |
cmd/doc: continue to search when package import fails
Keep searching for a package that is both findable and importable. The
current code would always guarantee that a package was findable but
exited if it was not importable.
Fixes #25478
Change-Id: I237b7dfafb930cae02538c4a2e4d5ce0c1058478
Reviewed-on: https://go-review.googlesource.com/114295
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/doc/doc_test.go')
| -rw-r--r-- | src/cmd/doc/doc_test.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/cmd/doc/doc_test.go b/src/cmd/doc/doc_test.go index f1072b5e41..e68e95f3fb 100644 --- a/src/cmd/doc/doc_test.go +++ b/src/cmd/doc/doc_test.go @@ -26,7 +26,7 @@ func TestMain(m *testing.M) { if err != nil { panic(err) } - dirsInit(testdataDir) + dirsInit(testdataDir, filepath.Join(testdataDir, "nested"), filepath.Join(testdataDir, "nested", "nested")) os.Exit(m.Run()) } @@ -510,6 +510,24 @@ var tests = []test{ "\\)\n+const", // This will appear if the const decl appears twice. }, }, + { + "non-imported: pkg.sym", + []string{"nested.Foo"}, + []string{"Foo struct"}, + nil, + }, + { + "non-imported: pkg only", + []string{"nested"}, + []string{"Foo struct"}, + nil, + }, + { + "non-imported: pkg sym", + []string{"nested", "Foo"}, + []string{"Foo struct"}, + nil, + }, } func TestDoc(t *testing.T) { |
