Commit 9b07abab authored by Robert Griesemer's avatar Robert Griesemer

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
parent c9bf30cf
...@@ -716,7 +716,8 @@ var whitelisted = map[string]bool{ ...@@ -716,7 +716,8 @@ var whitelisted = map[string]bool{
// isWhitelisted returns true if a file is on the list // 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 { func isWhitelisted(filename string) bool {
key := path.Ext(filename) key := path.Ext(filename)
if key == "" { if key == "" {
...@@ -745,7 +746,7 @@ func (x *Indexer) visitFile(dirname string, f *os.FileInfo) { ...@@ -745,7 +746,7 @@ func (x *Indexer) visitFile(dirname string, f *os.FileInfo) {
} }
goFile = true goFile = true
case !includeNonGoFiles || !isWhitelisted(filename): case !includeNonGoFiles || !isWhitelisted(f.Name):
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment