From c1ace4c9d935e3a51643436c6db179d627935656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatko=20=C4=8Calu=C5=A1i=C4=87?= Date: Mon, 16 Jan 2017 23:00:46 +0100 Subject: [PATCH] Don't shadow config struct --- handlers.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/handlers.go b/handlers.go index 8d94bb0..8dc75ee 100644 --- a/handlers.go +++ b/handlers.go @@ -75,8 +75,8 @@ func CheckConfig(w http.ResponseWriter, r *http.Request) { if config.debug { log.Println("CheckConfig()") } - config := filepath.Join(getRepo(r), "config") - st, err := os.Stat(config) + cfg := filepath.Join(getRepo(r), "config") + st, err := os.Stat(cfg) if err != nil { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return @@ -90,8 +90,8 @@ func GetConfig(w http.ResponseWriter, r *http.Request) { if config.debug { log.Println("GetConfig()") } - config := filepath.Join(getRepo(r), "config") - bytes, err := ioutil.ReadFile(config) + cfg := filepath.Join(getRepo(r), "config") + bytes, err := ioutil.ReadFile(cfg) if err != nil { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return @@ -105,13 +105,13 @@ func SaveConfig(w http.ResponseWriter, r *http.Request) { if config.debug { log.Println("SaveConfig()") } - config := filepath.Join(getRepo(r), "config") + cfg := filepath.Join(getRepo(r), "config") bytes, err := ioutil.ReadAll(r.Body) if err != nil { http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) return } - if err := ioutil.WriteFile(config, bytes, 0600); err != nil { + if err := ioutil.WriteFile(cfg, bytes, 0600); err != nil { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return }