Hacker News new | ask | show | jobs
by dgellow 1976 days ago
In production code people put panics around? I’ve never seen a situation like this. The convention to not use panic is quite strong
1 comments

And yet it certainly is there.
Panics are rare events that very few functions should ever need to think about. If the library truly cannot set itself up, it might be reasonable to panic (which is why panics are usually in the `main` package only). Once all the invariants have been checked, there is no reason to panic anytime after.