Use named suffixes for examples

This commit is contained in:
James Mills 2016-09-14 14:32:16 +10:00
parent beb2f8cca4
commit a5a853e26b
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
1 changed files with 3 additions and 4 deletions

View File

@ -11,7 +11,7 @@ func hello(w gopher.ResponseWriter, r *gopher.Request) {
w.WriteInfo("Hello World!") w.WriteInfo("Hello World!")
} }
func ExampleGet() { func Example_client() {
res, err := gopher.Get("gopher://gopher.floodgap.com") res, err := gopher.Get("gopher://gopher.floodgap.com")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
@ -19,13 +19,12 @@ func ExampleGet() {
fmt.Print(res.Dir.ToText()) fmt.Print(res.Dir.ToText())
} }
func ExampleServer() { func Example_server() {
gopher.HandleFunc("/hello", hello) gopher.HandleFunc("/hello", hello)
log.Fatal(gopher.ListenAndServe("localhost:7000", nil)) log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
} }
func ExampleFileServer() { func Example_fileserver() {
gopher.Handle("/", gopher.FileServer(gopher.Dir("/tmp"))) gopher.Handle("/", gopher.FileServer(gopher.Dir("/tmp")))
log.Fatal(gopher.ListenAndServe("localhost:7000", nil)) log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
} }