Hacker News new | ask | show | jobs
by vl 1073 days ago
In practice if you look into existing codebases, it is littered. defer is used for RAII-style clean up, so in 95% of the cases it's just return the error and that's it.
1 comments

Real world code base developed over a decade. Handles billions of emails.

Searching our prod code, "naked" if-err-return-err showed up in about 5% of error handling cases, the rest did something more (attempted a fallback, added context, logged something, metric maybe, etc).

If you are doing a naked return you are gonna have a bad time.