Y
Hacker News
new
|
ask
|
show
|
jobs
by
stouset
3507 days ago
Not to mention forgetting to `return` nil, err. If you just type `nil, err`, you don't handle the error and nothing complains. Oops.
1 comments
iand
3507 days ago
Er...
https://play.golang.org/p/QyQVFfPIhx
link
stouset
3507 days ago
Is this a recent change? I've with 100% been bitten by this before, repeatedly, and the go compiler did nothing to warn about it.
link
masklinn
3507 days ago
Maybe for a side-effecting function which would only return an error?
edit: nope, fails with "err evaluated but not used".
link
stouset
3506 days ago
I'm genuinely stumped. If they've fixed this, that's fantastic because I have absolutely shipped code with this bug to a production environment.
link
iand
3506 days ago
I've been working with Go for 4 years and I've not encountered it. Perhaps there was an edge case where it was allowed, but I don't recall it.
link