This is a nice succinct write-up about the new routing features in Go 1.22, which I think is probably the most useful addition in 1.22. I’m glad they’ve thought through all the gnarly issues about precedence and have a simple solution. Overall, I think this change will mean that we’ll almost never need 3rd party router packages any more (gorilla/mux and the like).
I like chi for route composability (sub-routers, etc..) and for middleware, but I imagine many simple use-cases will be able to be replaced with the new routing features.
I agree that the precedence rules seem very well thought out.
Yeah, I agree! It’s been a few years but this was pretty much the only thing stopping me from using naked net/http in otherwise simple API-only services. And yeah, very impressed with how well thought out the precedence rules are and happy they chose to panic early if you make rules that conflict instead of choosing some cryptic hard-to-reason-about tie-breaker rule.
This is a nice succinct write-up about the new routing features in Go 1.22, which I think is probably the most useful addition in 1.22. I’m glad they’ve thought through all the gnarly issues about precedence and have a simple solution. Overall, I think this change will mean that we’ll almost never need 3rd party router packages any more (gorilla/mux and the like).
I like chi for route composability (sub-routers, etc..) and for middleware, but I imagine many simple use-cases will be able to be replaced with the new routing features.
I agree that the precedence rules seem very well thought out.
Yeah, I agree! It’s been a few years but this was pretty much the only thing stopping me from using naked net/http in otherwise simple API-only services. And yeah, very impressed with how well thought out the precedence rules are and happy they chose to panic early if you make rules that conflict instead of choosing some cryptic hard-to-reason-about tie-breaker rule.