]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/godoc: move note argument to godoc.go
authorAndrew Gerrand <adg@golang.org>
Sun, 3 Mar 2013 22:02:45 +0000 (09:02 +1100)
committerAndrew Gerrand <adg@golang.org>
Sun, 3 Mar 2013 22:02:45 +0000 (09:02 +1100)
Fixes the App Engine version of godoc. The other fix is to duplicate
this code inside appinit.go. I think initHandlers is the right place
to put the strings.Split call, as the notesToShow var is used by
docServer, which is what initHandlers sets up.

R=dsymonds
CC=golang-dev
https://golang.org/cl/7434044

src/cmd/godoc/godoc.go
src/cmd/godoc/main.go

index 74f28835ada8b0c7e2246b4a432d376ddcc6be5c..872b0dc1ed696bf9ed7d8a146fa82e48f9bb8fe6 100644 (file)
@@ -83,9 +83,16 @@ var (
        fileServer http.Handler // default file server
        cmdHandler docServer
        pkgHandler docServer
+
+       // which code 'Notes' to show
+       notes = flag.String("notes", "BUG", "comma separated list of Note markers as per pkg:go/doc")
+       // list of 'Notes' to show
+       notesToShow []string
 )
 
 func initHandlers() {
+       notesToShow = strings.Split(*notes, ",")
+
        fileServer = http.FileServer(&httpFS{fs})
        cmdHandler = docServer{"/cmd/", "/src/cmd"}
        pkgHandler = docServer{"/pkg/", "/src/pkg"}
index 389bb1339df0c62f7bafbbe6752ccb66a779554e..13441009067876e2d733cdc3f190013991be6070 100644 (file)
@@ -71,11 +71,6 @@ var (
 
        // command-line searches
        query = flag.Bool("q", false, "arguments are considered search queries")
-
-       // which code 'Notes' to show.
-       notes = flag.String("notes", "BUG", "comma separated list of Note markers as per pkg:go/doc")
-       // vector of 'Notes' to show.
-       notesToShow []string
 )
 
 func serveError(w http.ResponseWriter, r *http.Request, relpath string, err error) {
@@ -162,8 +157,6 @@ func main() {
        flag.Usage = usage
        flag.Parse()
 
-       notesToShow = strings.Split(*notes, ",")
-
        // Check usage: either server and no args, command line and args, or index creation mode
        if (*httpAddr != "" || *urlFlag != "") != (flag.NArg() == 0) && !*writeIndex {
                usage()