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