Commit 4896b175 authored by Andrew Gerrand's avatar Andrew Gerrand

doc: update codelab wiki to fix template.Execute argument order

Fixes #1595.

R=r
CC=golang-dev
https://golang.org/cl/4243067
parent 758d0555
......@@ -73,7 +73,7 @@ func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
http.Error(w, err.String(), http.StatusInternalServerError)
return
}
err = t.Execute(p, w)
err = t.Execute(w, p)
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerError)
}
......
......@@ -35,14 +35,14 @@ func editHandler(w http.ResponseWriter, r *http.Request) {
p = &Page{Title: title}
}
t, _ := template.ParseFile("edit.html", nil)
t.Execute(p, w)
t.Execute(w, p)
}
func viewHandler(w http.ResponseWriter, r *http.Request) {
title := r.URL.Path[lenPath:]
p, _ := loadPage(title)
t, _ := template.ParseFile("view.html", nil)
t.Execute(p, w)
t.Execute(w, p)
}
func main() {
......
......@@ -61,7 +61,7 @@ func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
http.Error(w, err.String(), http.StatusInternalServerError)
return
}
err = t.Execute(p, w)
err = t.Execute(w, p)
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerError)
}
......
......@@ -53,7 +53,7 @@ func saveHandler(w http.ResponseWriter, r *http.Request) {
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
t, _ := template.ParseFile(tmpl+".html", nil)
t.Execute(p, w)
t.Execute(w, p)
}
func main() {
......
......@@ -475,7 +475,7 @@ func editHandler(w http.ResponseWriter, r *http.Request) {
p = &Page{Title: title}
}
t, _ := template.ParseFile("edit.html", nil)
t.Execute(p, w)
t.Execute(w, p)
}
</pre>
......@@ -527,7 +527,7 @@ func viewHandler(w http.ResponseWriter, r *http.Request) {
title := r.URL.Path[lenPath:]
p, _ := loadPage(title)
t, _ := template.ParseFile(&#34;view.html&#34;, nil)
t.Execute(p, w)
t.Execute(w, p)
}
</pre>
......@@ -555,7 +555,7 @@ func editHandler(w http.ResponseWriter, r *http.Request) {
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
t, _ := template.ParseFile(tmpl+&#34;.html&#34;, nil)
t.Execute(p, w)
t.Execute(w, p)
}
</pre>
......@@ -644,7 +644,7 @@ func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
http.Error(w, err.String(), http.StatusInternalServerError)
return
}
err = t.Execute(p, w)
err = t.Execute(w, p)
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerError)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment