Hard panic in a "not simple large app with large codebase" app because you couldn't match a route is amateur hour.
Re:Better HTTP server routing in Go 1.22
by numbsafari on Monday October 16, 2023 @01:02PM
(#37902844)
I think you are vastly oversimplifying what has been said or why it works the way that it does. I really recommend you read the design document and reasoning, as it is rather clear why they are doing it the way that they are. If you have a cogent contribution to the discussion, please do share.
Others have already contributed more than enough.
People's willingness to defend any and all of go's dubious decisions is really baffling.
I think you're assuming that the panic happens when a request is received, but it actually happens when a conflicting route is registered.
To me, that's reasonable behavior and is consistent with other things such as https://pkg.go.dev/regexp#MustCompile
Registering handlers is a startup activity ... Practically the only time I allow a panic in my code. I also have unit tests for the entire startup sequence so theoretically code with ambiguous handlers would never be committed.
Large code bases are large, and not every program is your simple crud app with a handful of endpoints that can be meaningfully managed a single function.