From: Robert Griesemer Date: Thu, 27 Jan 2011 22:11:58 +0000 (-0800) Subject: godoc: tiny bug fix - use correct filename when comparing files against the index... X-Git-Tag: weekly.2011-02-01~55 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9b07abab785cde1c3ffaccc2d0846b26f2659909;p=gostls13.git godoc: tiny bug fix - use correct filename when comparing files against the index whitelist This bug prevented files such as READMEs etc. from being included in the index. For instance, now author names recorded in the AUTHORS file can be found with a godoc query. R=rsc, r2 CC=golang-dev https://golang.org/cl/4005047 --- diff --git a/src/cmd/godoc/index.go b/src/cmd/godoc/index.go index 399c5bd3ff..581409cde6 100644 --- a/src/cmd/godoc/index.go +++ b/src/cmd/godoc/index.go @@ -716,7 +716,8 @@ var whitelisted = map[string]bool{ // isWhitelisted returns true if a file is on the list -// of "permitted" files for indexing. +// of "permitted" files for indexing. The filename must +// be the directory-local name of the file. func isWhitelisted(filename string) bool { key := path.Ext(filename) if key == "" { @@ -745,7 +746,7 @@ func (x *Indexer) visitFile(dirname string, f *os.FileInfo) { } goFile = true - case !includeNonGoFiles || !isWhitelisted(filename): + case !includeNonGoFiles || !isWhitelisted(f.Name): return }