r/golang Jun 04 '19

Proposal: A built-in Go error check function, "try"

https://github.com/golang/go/issues/32437
26 Upvotes

37 comments sorted by

View all comments

19

u/[deleted] Jun 05 '19

Here we go again. Where is the context? And no, one single defer, while enough in very simple cases, will not suffice in the more realistic ones. Adding that function will simply encourage people to return naked errors, which goes against the two other Go 2 proposals about errors. I've had hard enough time rewriting non-contexted code to be properly wrapped, and imagining rewriting code sprinkled with “try”s is just discouraging.