For Go 1.22: enhancements to Go’s HTTP routing capabilities. Namely, routes will be lockable to specific HTTP verbs (GET, POST, …) and will be able to take named path parameters (/item/{user}), crucial features that’ve been desperately needed in Go for 14 years (Go announced November 2009), and whose absence has created an absurd plethora of third party libraries to fill the vaccuum.

Example usage for ServeMux.Handle and ServeMux.HandleFunc:

/item/
POST /item/{user}
/item/{user}
/item/{user}/{id}
/item/{$}
POST alt.com/item/{user}

I was looking through our code and I think that with this available we’ll be able to tear out Mux, although a nicer way to do middleware and subrouters in net/http would be appreciated.

View all atoms ⭢