diff options
author | Andrew Gerrand <adg@golang.org> | 2012-03-12 15:55:39 +1100 |
---|---|---|
committer | Andrew Gerrand <adg@golang.org> | 2012-03-12 15:55:39 +1100 |
commit | 92d4af301e5c69b066b75475b3fce24e4fa51ab3 (patch) | |
tree | cbe11ce6ccb64ff891ce289a0ffe1b5761f60f95 | |
parent | 2ae860585920e17c1d43098c476ffb11c21b35f8 (diff) | |
download | go-92d4af301e5c69b066b75475b3fce24e4fa51ab3.tar.gz go-92d4af301e5c69b066b75475b3fce24e4fa51ab3.zip |
cmd/godoc: always include /doc files in union filesystems
Makes Path rewrites work, as the metadata was never being scanned.
Fixes #3282.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5783076
-rw-r--r-- | src/cmd/godoc/filesystem.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/godoc/filesystem.go b/src/cmd/godoc/filesystem.go index b1913cdd99..869e23ca25 100644 --- a/src/cmd/godoc/filesystem.go +++ b/src/cmd/godoc/filesystem.go @@ -420,11 +420,17 @@ func (ns nameSpace) ReadDir(path string) ([]os.FileInfo, error) { first = dir } + useFiles := false + + // Always include all files under /doc. + if path == "/doc" || strings.HasPrefix(path, "/doc/") { + useFiles = true // always include docs + } + // If we don't yet have Go files in 'all' and this directory // has some, add all the files from this directory. // Otherwise, only add subdirectories. - useFiles := false - if !haveGo { + if !useFiles && !haveGo { for _, d := range dir { if strings.HasSuffix(d.Name(), ".go") { useFiles = true |