From 70edd84d7cf2eebfe48f88ee01559e458e793f06 Mon Sep 17 00:00:00 2001 From: Carl Jackson Date: Sat, 22 Mar 2014 19:45:09 -0700 Subject: [PATCH] Move patternRe closer to its use --- web/pattern.go | 2 ++ web/router.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/pattern.go b/web/pattern.go index f6b11c7..952fc81 100644 --- a/web/pattern.go +++ b/web/pattern.go @@ -194,6 +194,8 @@ func (s stringPattern) String() string { return fmt.Sprintf("stringPattern(%q, %v)", s.raw, s.isPrefix) } +var patternRe = regexp.MustCompile(`/:([^/]+)`) + func parseStringPattern(s string, isPrefix bool) stringPattern { matches := patternRe.FindAllStringSubmatchIndex(s, -1) pats := make([]string, len(matches)) diff --git a/web/router.go b/web/router.go index 0db15c4..36d8141 100644 --- a/web/router.go +++ b/web/router.go @@ -65,8 +65,6 @@ type Pattern interface { Match(r *http.Request, c *C) bool } -var patternRe = regexp.MustCompile(`/:([^/]+)`) - func parsePattern(p interface{}, isPrefix bool) Pattern { switch p.(type) { case Pattern: