diff --git a/doc/codelab/wiki/final-template.go b/doc/codelab/wiki/final-template.go index 481cda1e69..06c9366ad8 100644 --- a/doc/codelab/wiki/final-template.go +++ b/doc/codelab/wiki/final-template.go @@ -34,13 +34,13 @@ func editHandler(c *http.Conn, r *http.Request) { if err != nil { p = &page{title: title} } - renderTemplate(c, "view", p) + renderTemplate(c, "edit", p) } func viewHandler(c *http.Conn, r *http.Request) { title := r.URL.Path[lenPath:] p, _ := loadPage(title) - renderTemplate(c, "edit", p) + renderTemplate(c, "view", p) } func saveHandler(c *http.Conn, r *http.Request) { diff --git a/doc/codelab/wiki/index.html b/doc/codelab/wiki/index.html index 7a078f0a5c..c63496e404 100644 --- a/doc/codelab/wiki/index.html +++ b/doc/codelab/wiki/index.html @@ -544,7 +544,7 @@ to its own function: func viewHandler(c *http.Conn, r *http.Request) { title := r.URL.Path[lenPath:] p, _ := loadPage(title) - renderTemplate(c, "edit", p) + renderTemplate(c, "view", p) } func editHandler(c *http.Conn, r *http.Request) { @@ -553,7 +553,7 @@ func editHandler(c *http.Conn, r *http.Request) { if err != nil { p = &page{title: title} } - renderTemplate(c, "view", p) + renderTemplate(c, "edit", p) } func renderTemplate(c *http.Conn, tmpl string, p *page) { diff --git a/doc/codelab/wiki/wiki.html b/doc/codelab/wiki/wiki.html index b5d7c8955b..5c89378744 100644 --- a/doc/codelab/wiki/wiki.html +++ b/doc/codelab/wiki/wiki.html @@ -58,13 +58,15 @@ package main import ( "fmt" "io/ioutil" + "os" )

-Both fmt and ioutil are built-in packages that -we'll be using. Later, as we implement additional functionality, we will add -more packages to this import declaration. +We import the fmt, ioutil and os +packages from the Go standard library. Later, as we implement additional +functionality, we will add more packages to this import +declaration.

Data Structures

@@ -161,7 +163,7 @@ function to return *page and os.Error.

Callers of this function can now check the second parameter; if it is -nil then it has succesfully loaded a page. If not, it will be an +nil then it has successfully loaded a page. If not, it will be an os.Error that can be handled by the caller (see the os package documentation for details). @@ -198,7 +200,7 @@ This is a sample page.

(The 8g and 8l commands are applicable to GOARCH=386. If you're on an amd64 system, -subtitute 6's for the 8's.) +substitute 6's for the 8's.)

@@ -268,6 +270,7 @@ import ( "fmt" "http" "io/ioutil" + "os" ) @@ -389,7 +392,7 @@ import (

-Let's create a template file containg the HTML form. +Let's create a template file containing the HTML form. Open a new file named edit.html, and add the following lines: