use assert1 func (#2783)

This commit is contained in:
Lanco 2021-07-11 14:38:45 +08:00 committed by GitHub
parent 3116a2d7a1
commit f96678cb6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,9 +214,7 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain { func (group *RouterGroup) combineHandlers(handlers HandlersChain) HandlersChain {
finalSize := len(group.Handlers) + len(handlers) finalSize := len(group.Handlers) + len(handlers)
if finalSize >= int(abortIndex) { assert1(finalSize < int(abortIndex), "too many handlers")
panic("too many handlers")
}
mergedHandlers := make(HandlersChain, finalSize) mergedHandlers := make(HandlersChain, finalSize)
copy(mergedHandlers, group.Handlers) copy(mergedHandlers, group.Handlers)
copy(mergedHandlers[len(group.Handlers):], handlers) copy(mergedHandlers[len(group.Handlers):], handlers)