4 ms·
It’s not an exception. There is no magic. Large code bases are large, and not every program is your simple crud app with a handful of endpoints that can be mea
by numbsafari 3y ago
It’s not an exception. There is no magic.
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.
- troupo 3y agoHard panic in a "not simple app with large codebase" app because you couldn't match a route is amateur hour.
- numbsafari 3y agoI 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.
- troupo 3y agoOthers have already contributed more than enough. People's willingness to defend any and all of go's dubious decisions is really baffling.
- msmith 3y agoI 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 https://pkg.go.dev/regexp#MustCompile
- smoyer 3y agoRegistering 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.