]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/godoc: always include /doc files in union filesystems
authorAndrew Gerrand <adg@golang.org>
Mon, 12 Mar 2012 04:55:39 +0000 (15:55 +1100)
committerAndrew Gerrand <adg@golang.org>
Mon, 12 Mar 2012 04:55:39 +0000 (15:55 +1100)
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

src/cmd/godoc/filesystem.go

index b1913cdd995cbb0fadcc78fc176b68e997d0b9ba..869e23ca25220e0002e5f5c0b4b5352ccc8f34ba 100644 (file)
@@ -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