Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> They did introduce panic, they just discourage anyone outside the language design team from taking advantage of it.

The guidance I remember when I was trying out go and researching idiomatic Go style was not “don’t use panic in your code” but “don’t expose panics [other than the ‘always and everytime fatal’ kind] across the public API surface of your code”.

Basically, if someone other than the code owner would want to react to it, it should be converted to an error return before hitting the code consuming your library.



This is my understanding too, and when I’ve seen panic I always see it treated as fatal/terminating.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: