mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
godoc: show synopses for subdirectories in package view
In command-line mode, we were traversing the dir tree with depth of only 1. This prevented the synopses of sub-directories from being scanned and showed in the output when a package path was being passed. Increasing the depth to 2 so that sub-directories of the next level is also parsed and the synopses gets shown. Also fixed the comment to reflect that dir can be nil only in command-line mode now after golang.org/cl/93215 Fixes golang/go#22646 Change-Id: I066a3bc3ba3d9d3a9589f97137e1bc4497a45473 Reviewed-on: https://go-review.googlesource.com/93675 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
parent
86e0f6745d
commit
2ae76fd156
@ -200,11 +200,12 @@ func (h *handlerServer) GetPageInfo(abspath, relpath string, mode PageInfoMode,
|
|||||||
timestamp = ts
|
timestamp = ts
|
||||||
}
|
}
|
||||||
if dir == nil {
|
if dir == nil {
|
||||||
// no directory tree present (too early after startup or
|
// no directory tree present (happens in command-line mode);
|
||||||
// command-line mode); compute one level for this page
|
// compute 2 levels for this page. The second level is to
|
||||||
|
// get the synopses of sub-directories.
|
||||||
// note: cannot use path filter here because in general
|
// note: cannot use path filter here because in general
|
||||||
// it doesn't contain the FSTree path
|
// it doesn't contain the FSTree path
|
||||||
dir = h.c.newDirectory(abspath, 1)
|
dir = h.c.newDirectory(abspath, 2)
|
||||||
timestamp = time.Now()
|
timestamp = time.Now()
|
||||||
}
|
}
|
||||||
info.Dirs = dir.listing(true, func(path string) bool { return h.includePath(path, mode) })
|
info.Dirs = dir.listing(true, func(path string) bool { return h.includePath(path, mode) })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user