1
0
mirror of https://github.com/golang/go synced 2024-11-25 17:57:56 -07:00

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

R=rsc
CC=golang-dev
https://golang.org/cl/206109
This commit is contained in:
Robert Griesemer 2010-02-16 12:49:41 -08:00
parent ffd0961313
commit ca075494a6
2 changed files with 4 additions and 1 deletions

View File

@ -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}
} }

View File

@ -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 != "" {