Skip to content

Commit

Permalink
PR feedback - map -> array, camel case fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
elementalvoid committed Apr 4, 2016
1 parent ce91a61 commit 0c99996
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server.go
Expand Up @@ -21,12 +21,11 @@ func fallback(w http.ResponseWriter, r *http.Request, reason string) {
} }


func getRedirect(txt []string, url string) (*Redirect, error) { func getRedirect(txt []string, url string) (*Redirect, error) {
catch_alls := make(map[string]*Config) var catchAlls []*Config

for _, record := range txt { for _, record := range txt {
config := Parse(record) config := Parse(record)
if strings.TrimSpace(config.From) == "" { if config.From == "" {
catch_alls[record] = config catchAlls = append(catchAlls, config)
continue continue
} }
redirect := Translate(url, config) redirect := Translate(url, config)
Expand All @@ -36,7 +35,7 @@ func getRedirect(txt []string, url string) (*Redirect, error) {
} }


var config *Config var config *Config
for _, config = range catch_alls { for _, config = range catchAlls {
redirect := Translate(url, config) redirect := Translate(url, config)
if redirect != nil { if redirect != nil {
return redirect, nil return redirect, nil
Expand Down

0 comments on commit 0c99996

Please sign in to comment.