From cafd7296f43639bbcd2601bea79a47f60763a200 Mon Sep 17 00:00:00 2001 From: Rajat Jain Date: Fri, 29 Jan 2021 01:35:19 +0530 Subject: [PATCH] linting fix --- modules/caddyhttp/map/map.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/caddyhttp/map/map.go b/modules/caddyhttp/map/map.go index eb4c441c..652793e1 100644 --- a/modules/caddyhttp/map/map.go +++ b/modules/caddyhttp/map/map.go @@ -133,15 +133,17 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhtt for _, m := range h.Mappings { if m.re != nil { matchRegexp := caddyhttp.MatchRegexp{Pattern: m.InputRegexp} - matchRegexp.Provision(caddy.Context{}) - err := matchRegexp.Validate() + err := matchRegexp.Provision(caddy.Context{}) if err == nil { - if matchRegexp.Match(input, repl) { - if output := m.Outputs[destIdx]; output == nil { - continue - } else { - output = repl.ReplaceAll(m.Outputs[destIdx].(string), "") - return output, true + err = matchRegexp.Validate() + if err == nil { + if matchRegexp.Match(input, repl) { + if output := m.Outputs[destIdx]; output == nil { + continue + } else { + output = repl.ReplaceAll(m.Outputs[destIdx].(string), "") + return output, true + } } } }