mirror of
https://github.com/golang/go
synced 2024-11-22 04:04:40 -07:00
godoc: quiet log spam
Fixes #3191. Sorry. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5726059
This commit is contained in:
parent
ed35d5e0fb
commit
8e5b34e580
@ -69,13 +69,7 @@ func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list, err := fs.ReadDir(path)
|
list, _ := fs.ReadDir(path)
|
||||||
if err != nil {
|
|
||||||
// newDirTree is called with a path that should be a package
|
|
||||||
// directory; errors here should not happen, but if they do,
|
|
||||||
// we want to know about them
|
|
||||||
log.Printf("ReadDir(%s): %s", path, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine number of subdirectories and if there are package files
|
// determine number of subdirectories and if there are package files
|
||||||
ndirs := 0
|
ndirs := 0
|
||||||
|
@ -400,6 +400,7 @@ func (ns nameSpace) ReadDir(path string) ([]os.FileInfo, error) {
|
|||||||
haveName = map[string]bool{}
|
haveName = map[string]bool{}
|
||||||
all []os.FileInfo
|
all []os.FileInfo
|
||||||
err error
|
err error
|
||||||
|
first []os.FileInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, m := range ns.resolve(path) {
|
for _, m := range ns.resolve(path) {
|
||||||
@ -411,6 +412,14 @@ func (ns nameSpace) ReadDir(path string) ([]os.FileInfo, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dir == nil {
|
||||||
|
dir = []os.FileInfo{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if first == nil {
|
||||||
|
first = dir
|
||||||
|
}
|
||||||
|
|
||||||
// If we don't yet have Go files in 'all' and this directory
|
// If we don't yet have Go files in 'all' and this directory
|
||||||
// has some, add all the files from this directory.
|
// has some, add all the files from this directory.
|
||||||
// Otherwise, only add subdirectories.
|
// Otherwise, only add subdirectories.
|
||||||
@ -434,6 +443,15 @@ func (ns nameSpace) ReadDir(path string) ([]os.FileInfo, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We didn't find any directories containing Go files.
|
||||||
|
// If some directory returned successfully, use that.
|
||||||
|
if len(all) == 0 && first != nil {
|
||||||
|
for _, d := range first {
|
||||||
|
haveName[d.Name()] = true
|
||||||
|
all = append(all, d)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Built union. Add any missing directories needed to reach mount points.
|
// Built union. Add any missing directories needed to reach mount points.
|
||||||
for old := range ns {
|
for old := range ns {
|
||||||
if hasPathPrefix(old, path) && old != path {
|
if hasPathPrefix(old, path) && old != path {
|
||||||
|
@ -658,7 +658,6 @@ func serveDirectory(w http.ResponseWriter, r *http.Request, abspath, relpath str
|
|||||||
|
|
||||||
list, err := fs.ReadDir(abspath)
|
list, err := fs.ReadDir(abspath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("ReadDir: %s", err)
|
|
||||||
serveError(w, r, relpath, err)
|
serveError(w, r, relpath, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user