Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
donatj
on June 30, 2017
|
parent
|
context
|
favorite
| on:
Benefits of named return values in Go
I feel like a lot of deferred errors go unhandled because inexperienced devs don't know that they can.
dullgiulio
on June 30, 2017
|
next
[–]
That's one big reason why naked returns are frowned upon.
It's much easier to read code where there is a clean "return nil, fmt.Errorf(...)".
weberc2
on June 30, 2017
|
prev
[–]
I don't do it, but mostly because all I would be doing is logging the error, and if some day it takes me a little longer to root cause some odd file close error, I'll still come out ahead.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: