From f96678cb6b897f92921a2a52ae1c9f0248346a12 Mon Sep 17 00:00:00 2001 From: Lanco <35420416+lancoLiu@users.noreply.github.com> Date: Sun, 11 Jul 2021 14:38:45 +0800 Subject: [PATCH] use assert1 func (#2783) --- routergroup.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/routergroup.go b/routergroup.go index 6f14bf5..bb24bd5 100644 --- a/routergroup.go +++ b/routergroup.go @@ -214,9 +214,7 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain { finalSize := len(group.Handlers) + len(handlers) - if finalSize >= int(abortIndex) { - panic("too many handlers") - } + assert1(finalSize < int(abortIndex), "too many handlers") mergedHandlers := make(HandlersChain, finalSize) copy(mergedHandlers, group.Handlers) copy(mergedHandlers[len(group.Handlers):], handlers)