cmd/godoc: don't start up indexer in command-line mode

Fixes golang/go#6075

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12995044
This commit is contained in:
Brad Fitzpatrick 2013-08-16 19:49:24 -07:00
parent 32acd2b372
commit 1633383a2b
1 changed files with 8 additions and 4 deletions

View File

@ -214,16 +214,20 @@ func main() {
fs.Bind("/src/pkg", vfs.OS(p), "/src", vfs.BindAfter)
}
httpMode := *httpAddr != ""
corpus := godoc.NewCorpus(fs)
corpus.Verbose = *verbose
corpus.IndexEnabled = *indexEnabled
corpus.IndexEnabled = *indexEnabled && httpMode
corpus.IndexFiles = *indexFiles
if *writeIndex {
corpus.IndexThrottle = 1.0
}
if *writeIndex || httpMode || *urlFlag != "" {
if err := corpus.Init(); err != nil {
log.Fatal(err)
}
}
pres = godoc.NewPresentation(corpus)
pres.TabWidth = *tabWidth
@ -270,7 +274,7 @@ func main() {
return
}
if *httpAddr != "" {
if httpMode {
// HTTP server mode.
var handler http.Handler = http.DefaultServeMux
if *verbose {