From 123d560a4488fad0998a90f46cada46e3849b20d Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Fri, 7 Jul 2023 10:03:11 +0800 Subject: [PATCH] chore: replace loop with mux.mws = append(mux.mws, mws...) --- servemux.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/servemux.go b/servemux.go index c11fbce..411dcf8 100644 --- a/servemux.go +++ b/servemux.go @@ -144,9 +144,7 @@ func (mux *ServeMux) HandleFunc(pattern string, handler func(context.Context, *T func (mux *ServeMux) Use(mws ...MiddlewareFunc) { mux.mu.Lock() defer mux.mu.Unlock() - for _, fn := range mws { - mux.mws = append(mux.mws, fn) - } + mux.mws = append(mux.mws, mws...) } // NotFound returns an error indicating that the handler was not found for the given task.