3 ms·
This is a trivial snippet. Often you will transform/map your error into another type (or deal with it in some way), so it's not so much `if err != nil { return
by Alupis 1y ago
This is a trivial snippet. Often you will transform/map your error into another type (or deal with it in some way), so it's not so much `if err != nil { return err; }` vibes like you're thinking here.
The beauty here is being compelled to handle both the happy and sad paths. You cannot just pretend the sad path doesn't exist.
- samdoesnothing 1y agoGood Go code also wraps errors...
- wavemode 1y agoIt's not just about wrapping. use-expressions, result.try and result.map eliminate the boilerplate of checking for errors entirely: https://erikarow.land/notes/using-use-gleam https://erikarow.land/notes/using-use-gleam
- samdoesnothing 1y agoOne man's boilerplate is another man's explicitness.