Skip to content

Commit

Permalink
chore: replace loop with mux.mws = append(mux.mws, mws...)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored and hibiken committed Jul 8, 2023
1 parent 5bef53d commit 123d560
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions servemux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 123d560

Please sign in to comment.