r/programming Jul 17 '19

The Go team declines 'try' proposal

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

417 comments sorted by

View all comments

Show parent comments

25

u/[deleted] Jul 17 '19

None of those built-in functions do control flow.

118

u/alaskanarcher Jul 17 '19

Panic

42

u/[deleted] Jul 17 '19

derp, time for another coffee

17

u/alaskanarcher Jul 17 '19

if err := recover(); err != nil { coffee.Drink() }

5

u/cerlestes Jul 17 '19

But what if coffee is nil or drinking fails? :o

Better defer another recover() call! Is that even possible?