1
0
mirror of https://github.com/golang/go synced 2024-11-12 07:10:22 -07:00

godoc: fix codewalk handler

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
This commit is contained in:
Francisco Souza 2012-03-13 09:08:04 +11:00 committed by Andrew Gerrand
parent 60b98d6208
commit bb6e685b7b

View 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)