diff options
| author | Russ Cox <rsc@golang.org> | 2010-04-05 22:55:05 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-04-05 22:55:05 -0700 |
| commit | a267ff6a815ce9f8f92f9bcb41cc53f6ebae122a (patch) | |
| tree | 478e50bc78fb1168e9d7ff38ca7a61a9ecca99f2 /src | |
| parent | edcd70e07a803b13bff09b950be80a23261f7f89 (diff) | |
| download | go-a267ff6a815ce9f8f92f9bcb41cc53f6ebae122a.tar.xz | |
http: fix documentation example
R=adg
CC=golang-dev
https://golang.org/cl/813043
Diffstat (limited to 'src')
| -rw-r--r-- | src/pkg/http/server.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go index bd1d0a703f..a28eb25ee4 100644 --- a/src/pkg/http/server.go +++ b/src/pkg/http/server.go @@ -571,20 +571,21 @@ func Serve(l net.Listener, handler Handler) os.Error { // package main // // import ( -// "http"; -// "io"; +// "http" +// "io" +// "log" // ) // // // hello world, the web server // func HelloServer(c *http.Conn, req *http.Request) { -// io.WriteString(c, "hello, world!\n"); +// io.WriteString(c, "hello, world!\n") // } // // func main() { -// http.Handle("/hello", http.HandlerFunc(HelloServer)); -// err := http.ListenAndServe(":12345", nil); +// http.HandleFunc("/hello", HelloServer) +// err := http.ListenAndServe(":12345", nil) // if err != nil { -// panic("ListenAndServe: ", err.String()) +// log.Exit("ListenAndServe: ", err.String()) // } // } func ListenAndServe(addr string, handler Handler) os.Error { |
