1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:47:56 -07:00

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
This commit is contained in:
Robert Griesemer 2011-01-27 14:11:58 -08:00
parent c9bf30cf19
commit 9b07abab78

View File

@ -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) {
} }
goFile = true goFile = true
case !includeNonGoFiles || !isWhitelisted(filename): case !includeNonGoFiles || !isWhitelisted(f.Name):
return return
} }