diff options
author | Robert Griesemer <gri@golang.org> | 2010-11-19 14:05:12 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2010-11-19 14:05:12 -0800 |
commit | b1fd0860df0683ebe94267a78020864b26b44d7a (patch) | |
tree | 14998230380b6533c184c844c3c8495aea594128 | |
parent | b84b20b820a41ae78881ebefa4e768a264dfb203 (diff) | |
download | go-b1fd0860df0683ebe94267a78020864b26b44d7a.tar.gz go-b1fd0860df0683ebe94267a78020864b26b44d7a.zip |
godoc: use correct time stamp to indicate accuracy of search result
- compare against fsModified to check if index is out of date
- don't change fsModified if there are no user-mapped file systems
R=rsc, iant
CC=golang-dev
https://golang.org/cl/3213041
-rw-r--r-- | src/cmd/godoc/godoc.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index d941e7b891..919b41626e 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -186,11 +186,13 @@ func readDirList(filename string) ([]string, os.Error) { // is provided, it is used to filter directories. // func updateMappedDirs(filter func(string) bool) { - fsMap.Iterate(func(path string, value *RWValue) bool { - value.set(newDirectory(path, filter, -1)) - return true - }) - invalidateIndex() + if !fsMap.IsEmpty() { + fsMap.Iterate(func(path string, value *RWValue) bool { + value.set(newDirectory(path, filter, -1)) + return true + }) + invalidateIndex() + } } @@ -1323,7 +1325,7 @@ func lookup(query string) (result SearchResult) { result.Query = query if index, timestamp := searchIndex.get(); index != nil { result.Hit, result.Alt, result.Illegal = index.(*Index).Lookup(query) - _, ts := fsTree.get() + _, ts := fsModified.get() result.Accurate = timestamp >= ts } return |