From 74e7b315b99a8a26d0e41c2cc28874993d875526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Mon, 15 Jan 2018 14:05:16 +0100 Subject: [PATCH] fix indentation --- src/itix.fr/forward/main.go | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/itix.fr/forward/main.go b/src/itix.fr/forward/main.go index 767d9e7..4ca3b74 100644 --- a/src/itix.fr/forward/main.go +++ b/src/itix.fr/forward/main.go @@ -6,7 +6,7 @@ import ( "net/http/httputil" "net/url" "os" - "strconv" + "strconv" ) // The MyResponseWriter is a wrapper around the standard http.ResponseWriter @@ -52,7 +52,7 @@ func SetupReverseProxy(local_port int, target string) { // added automatically by the net/http package. req.Host = "" } - handler := http.NewServeMux() + handler := http.NewServeMux() handler.HandleFunc("/", func(rw http.ResponseWriter, req *http.Request) { // Log the incoming request (including headers) fmt.Printf("%v %v HTTP/1.1\n", req.Method, req.URL) @@ -74,27 +74,27 @@ func SetupReverseProxy(local_port int, target string) { }) fmt.Printf("Listening on port %v for incoming requests...\n", local_port) - err = http.ListenAndServe(fmt.Sprintf(":%v", local_port), handler) - if (err != nil) { - fmt.Println("ERROR: %s", err) - } + err = http.ListenAndServe(fmt.Sprintf(":%v", local_port), handler) + if err != nil { + fmt.Println("ERROR: %s", err) + } } func main() { portal_endpoint := os.Getenv("THREESCALE_PORTAL_ENDPOINT") backend_endpoint := os.Getenv("BACKEND_ENDPOINT_OVERRIDE") - portal_port_opt := os.Getenv("PORTAL_LISTEN_PORT") - if (portal_port_opt == "") { - portal_port_opt = "9090" - fmt.Println("WARNING: No PORTAL_LISTEN_PORT environment variable found, defaulting to '9090'...") - } + portal_port_opt := os.Getenv("PORTAL_LISTEN_PORT") + if portal_port_opt == "" { + portal_port_opt = "9090" + fmt.Println("WARNING: No PORTAL_LISTEN_PORT environment variable found, defaulting to '9090'...") + } - backend_port_opt := os.Getenv("BACKEND_LISTEN_PORT") - if (backend_port_opt == "") { - backend_port_opt = "9091" - fmt.Println("WARNING: No BACKEND_LISTEN_PORT environment variable found, defaulting to '9091'...") - } + backend_port_opt := os.Getenv("BACKEND_LISTEN_PORT") + if backend_port_opt == "" { + backend_port_opt = "9091" + fmt.Println("WARNING: No BACKEND_LISTEN_PORT environment variable found, defaulting to '9091'...") + } error := false if portal_endpoint == "" { @@ -105,16 +105,16 @@ func main() { fmt.Println("ERROR: No BACKEND_ENDPOINT_OVERRIDE environment variable found !") error = true } - portal_port, err := strconv.Atoi(portal_port_opt) - if (err != nil) { - fmt.Printf("ERROR: Cannot parse the PORTAL_LISTEN_PORT environment variable (%s): %s\n", portal_port_opt, err) + portal_port, err := strconv.Atoi(portal_port_opt) + if err != nil { + fmt.Printf("ERROR: Cannot parse the PORTAL_LISTEN_PORT environment variable (%s): %s\n", portal_port_opt, err) error = true - } - backend_port, err := strconv.Atoi(backend_port_opt) - if (err != nil) { - fmt.Printf("ERROR: Cannot parse the BACKEND_LISTEN_PORT environment variable (%s): %s\n", backend_port_opt, err) + } + backend_port, err := strconv.Atoi(backend_port_opt) + if err != nil { + fmt.Printf("ERROR: Cannot parse the BACKEND_LISTEN_PORT environment variable (%s): %s\n", backend_port_opt, err) error = true - } + } if error { os.Exit(1) }