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:
parent
ffd0961313
commit
ca075494a6
@ -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() {
|
|||||||
log.Exitf("negative tabwidth %d", *tabwidth)
|
log.Exitf("negative tabwidth %d", *tabwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initHandlers()
|
||||||
readTemplates()
|
readTemplates()
|
||||||
|
|
||||||
if *httpaddr != "" {
|
if *httpaddr != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user