]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: fix codewalk handler
authorFrancisco Souza <franciscossouza@gmail.com>
Mon, 12 Mar 2012 22:08:04 +0000 (09:08 +1100)
committerAndrew Gerrand <adg@golang.org>
Mon, 12 Mar 2012 22:08:04 +0000 (09:08 +1100)
For URLs ending with /, the handler did not work, trying to append
".xml" to the path.

For instance, the "Share Memory by Communicating" returned the
following error:

        open /Users/francisco.souza/lib/go/doc/codewalk/sharemem/.xml: no such file or directory

R=adg, minux.ma
CC=golang-dev
https://golang.org/cl/5797065

src/cmd/godoc/codewalk.go

index 2804ebbe5df85e3cbec0d9b70e960e8a6c562a05..3e38162a487edbd1611064ceff502ea25e2f4e9d 100644 (file)
@@ -53,7 +53,9 @@ func codewalk(w http.ResponseWriter, r *http.Request) {
        }
 
        // Otherwise append .xml and hope to find
-       // a codewalk description.
+       // a codewalk description, but before trim
+       // the trailing /.
+       abspath = strings.TrimRight(abspath, "/")
        cw, err := loadCodewalk(abspath + ".xml")
        if err != nil {
                log.Print(err)