Fixed godoc example for Get() and added example for FileServer

This commit is contained in:
James Mills 2016-09-14 14:23:24 +10:00
parent 8e892d31ed
commit beb2f8cca4
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

View File

@ -11,7 +11,7 @@ func hello(w gopher.ResponseWriter, r *gopher.Request) {
w.WriteInfo("Hello World!")
}
func ExampleClient() {
func ExampleGet() {
res, err := gopher.Get("gopher://gopher.floodgap.com")
if err != nil {
log.Fatal(err)
@ -23,3 +23,9 @@ func ExampleServer() {
gopher.HandleFunc("/hello", hello)
log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
}
func ExampleFileServer() {
gopher.Handle("/", gopher.FileServer(gopher.Dir("/tmp")))
log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
}