Commit ca075494 authored by Robert Griesemer's avatar Robert Griesemer

godoc: initialize vars depending on flags after parsing the flags.

R=rsc
CC=golang-dev
https://golang.org/cl/206109
parent ffd09613
...@@ -111,10 +111,12 @@ func init() { ...@@ -111,10 +111,12 @@ func init() {
flag.StringVar(&cmdroot, "cmdroot", pathutil.Join(goroot, "src/cmd"), "command source directory") flag.StringVar(&cmdroot, "cmdroot", pathutil.Join(goroot, "src/cmd"), "command source directory")
flag.StringVar(&pkgroot, "pkgroot", pathutil.Join(goroot, "src/pkg"), "package source directory") flag.StringVar(&pkgroot, "pkgroot", pathutil.Join(goroot, "src/pkg"), "package source directory")
flag.StringVar(&tmplroot, "tmplroot", pathutil.Join(goroot, "lib/godoc"), "template directory") flag.StringVar(&tmplroot, "tmplroot", pathutil.Join(goroot, "lib/godoc"), "template directory")
}
func initHandlers() {
fsMap.Init(*path) fsMap.Init(*path)
fileServer = http.FileServer(goroot, "") fileServer = http.FileServer(goroot, "")
cmdHandler = httpHandler{"/cmd/", cmdroot, false} cmdHandler = httpHandler{"/cmd/", cmdroot, false}
pkgHandler = httpHandler{"/pkg/", pkgroot, true} pkgHandler = httpHandler{"/pkg/", pkgroot, true}
} }
......
...@@ -152,6 +152,7 @@ func main() { ...@@ -152,6 +152,7 @@ func main() {
log.Exitf("negative tabwidth %d", *tabwidth) log.Exitf("negative tabwidth %d", *tabwidth)
} }
initHandlers()
readTemplates() readTemplates()
if *httpaddr != "" { if *httpaddr != "" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment