// the find
gorilla/mux
Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍
gorilla/mux is a battle-tested HTTP router for Go that extends the standard library's ServeMux with named path variables, regex constraints, host matching, subrouters, and URL reversal. It's been the default choice for Go HTTP routing for over a decade. If you're starting a new project today, you'd probably reach for chi or the stdlib's improved 1.22 router first, but mux still has the widest ecosystem support.
Named route variables with optional regex constraints ({id:[0-9]+}) are cleaner than anything in stdlib pre-1.22. URL reversal via r.Get("name").URL(...) is genuinely useful for avoiding hardcoded paths scattered through templates and tests. Subrouters let you group routes by host or path prefix, which keeps middleware application surgical rather than global. The middleware interface is just func(http.Handler) http.Handler — no custom types, plays well with any compatible middleware.
Last meaningful commit was mid-2024 and the gorilla org has had long maintenance gaps before; the project was briefly archived in 2022. Performance is noticeably slower than chi or httprouter because regex matching runs on every request even when the route has no variables. Go 1.22 added method and path variable support directly to net/http/ServeMux, which covers the most common mux use cases without a dependency. The CORS support is half-baked — CORSMethodMiddleware only sets the Allow-Methods header, you still have to handle everything else yourself.