From 573cb47955bb09d8a09d029fa353bf477066d22f Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Tue, 4 Jun 2019 07:44:57 -0700 Subject: [PATCH] Rebuild for tabs --- examples/http-servers/http-servers.go | 52 +++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/http-servers/http-servers.go b/examples/http-servers/http-servers.go index 5331a75..7556b2d 100644 --- a/examples/http-servers/http-servers.go +++ b/examples/http-servers/http-servers.go @@ -3,8 +3,8 @@ package main import ( - "fmt" - "net/http" + "fmt" + "net/http" ) // A fundamental concept in `net/http` servers is @@ -14,37 +14,37 @@ import ( // on functions with the appropriate signature. func hello(w http.ResponseWriter, req *http.Request) { - // Functions serving as handlers take a - // `http.ResponseWriter` and a `http.Request` as - // arguments. The response writer is used to fill in the - // HTTP response. Here out simple response is just - // "hello\n". - fmt.Fprintf(w, "hello\n") + // Functions serving as handlers take a + // `http.ResponseWriter` and a `http.Request` as + // arguments. The response writer is used to fill in the + // HTTP response. Here out simple response is just + // "hello\n". + fmt.Fprintf(w, "hello\n") } func headers(w http.ResponseWriter, req *http.Request) { - // This handler does something a little more - // sophisticated by reading all the HTTP request - // headers and echoing them into the response body. - for name, headers := range req.Header { - for _, h := range headers { - fmt.Fprintf(w, "%v: %v\n", name, h) - } - } + // This handler does something a little more + // sophisticated by reading all the HTTP request + // headers and echoing them into the response body. + for name, headers := range req.Header { + for _, h := range headers { + fmt.Fprintf(w, "%v: %v\n", name, h) + } + } } func main() { - // We register our handlers on server routes using the - // `http.HandleFunc` convenience function. It sets up - // the *default router* in the `net/http` package and - // takes a function as an argument. - http.HandleFunc("/hello", hello) - http.HandleFunc("/headers", headers) + // We register our handlers on server routes using the + // `http.HandleFunc` convenience function. It sets up + // the *default router* in the `net/http` package and + // takes a function as an argument. + http.HandleFunc("/hello", hello) + http.HandleFunc("/headers", headers) - // Finally, we call the `ListenAndServe` with the port - // and a handler. `nil` tells it to use the default - // router we've just set up. - http.ListenAndServe(":8090", nil) + // Finally, we call the `ListenAndServe` with the port + // and a handler. `nil` tells it to use the default + // router we've just set up. + http.ListenAndServe(":8090", nil) }