3 ms·
what's wrong with zd, _ := gzip.NewReader() ? This too is obvious to go readers, and the current correct way to ignore errors.
by jmprspret 3y ago
what's wrong with
zd, _ := gzip.NewReader()
?
This too is obvious to go readers, and the current correct way to ignore errors.
- goalonetwo 3y agoThis completely ignores the error. What you want is to send the error back up, without the need to be super verbose with if err != nil { return nil, err }
- jmprspret 3y agoOkay, I see where my misunderstanding is now. I didn't realise this is for sending them "up".
- masklinn 3y agoThe goal is not to ignore the error but to make it easier to propagate it. Similar to Haskell’s do form or rust’s ? operator.
- wolf550e 3y agoHe doesn't want to ignore the error, he wants exceptions-like behavior where the exceptions just propagate up by themselves if you don't catch them inside the function. Like Java or Python exceptions.