From c0571e37c3d83b59c8448ba7f1e6dd7f423bac8c Mon Sep 17 00:00:00 2001 From: Vishal Rana Date: Thu, 24 Sep 2015 15:15:52 -0700 Subject: [PATCH] Moving some logic around Signed-off-by: Vishal Rana --- router.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/router.go b/router.go index 1a4c0603..8214a485 100644 --- a/router.go +++ b/router.go @@ -285,7 +285,7 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo // Strip trailing slash if r.echo.stripTrailingSlash { - l := len(path)-1 + l := len(path) - 1 if path != "/" && path[l] == '/' { // Issue #218 path = path[:l] } @@ -386,15 +386,12 @@ func (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, e *Echo // Match-any node MatchAny: // c = cn.getChild() - c = cn.findChildWithType(mtype) - if c != nil { - cn = c - ctx.pvalues[len(cn.pnames)-1] = search - goto Found + if cn = cn.findChildWithType(mtype); cn == nil { + // Not found + return } - - // Not found - return + ctx.pvalues[len(cn.pnames)-1] = search + goto Found } Found: