From 0c999960a8124392b9001ae88a73679f2f413f1c Mon Sep 17 00:00:00 2001 From: Matt Klich Date: Mon, 4 Apr 2016 10:33:32 -0600 Subject: [PATCH] PR feedback - map -> array, camel case fix. --- server.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server.go b/server.go index 1a66e69..19163e3 100644 --- a/server.go +++ b/server.go @@ -21,12 +21,11 @@ func fallback(w http.ResponseWriter, r *http.Request, reason string) { } func getRedirect(txt []string, url string) (*Redirect, error) { - catch_alls := make(map[string]*Config) - + var catchAlls []*Config for _, record := range txt { config := Parse(record) - if strings.TrimSpace(config.From) == "" { - catch_alls[record] = config + if config.From == "" { + catchAlls = append(catchAlls, config) continue } redirect := Translate(url, config) @@ -36,7 +35,7 @@ func getRedirect(txt []string, url string) (*Redirect, error) { } var config *Config - for _, config = range catch_alls { + for _, config = range catchAlls { redirect := Translate(url, config) if redirect != nil { return redirect, nil