From: Robert Griesemer Date: Fri, 19 Nov 2010 22:05:12 +0000 (-0800) Subject: godoc: use correct time stamp to indicate accuracy of search result X-Git-Tag: weekly.2010-11-23~7 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b1fd0860df0683ebe94267a78020864b26b44d7a;p=gostls13.git 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 --- 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