doc/articles/wiki: fix path handling and clean up test process
Fixes #6525.
R=r
CC=golang-dev
https://golang.org/cl/14383043
diff --git a/doc/articles/wiki/final-noerror.go b/doc/articles/wiki/final-noerror.go
index e11d268..86d8da7 100644
--- a/doc/articles/wiki/final-noerror.go
+++ b/doc/articles/wiki/final-noerror.go
@@ -29,10 +29,8 @@
return &Page{Title: title, Body: body}, nil
}
-const lenPath = len("/view/")
-
func editHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[lenPath:]
+ title := r.URL.Path[len("/edit/"):]
p, err := loadPage(title)
if err != nil {
p = &Page{Title: title}
@@ -42,7 +40,7 @@
}
func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[lenPath:]
+ title := r.URL.Path[len("/view/"):]
p, _ := loadPage(title)
t, _ := template.ParseFiles("view.html")
t.Execute(w, p)