This proposal has attracted modest attention from the Go team... https://github.com/golang/go/issues/32611
It suggests: err := f() on err, <single_statement> on err, return err // any type can be tested for non-zero on err, return fmt.Errorf(...) on err, fmt.Println(err) // doesn't stop the function on err, continue // retry in a loop on err, goto label // labeled handler invocation on err, hname // named handler invocation And offers these possible extensions: on err, os.IsNotExist(err): <stmt> on err, err == io.EOF: <stmt> on err, err.(*os.PathError): <stmt> // doesn't panic if not a match on err, <condition>: <stmt> on err: <stmt> // this pair provides if/else in 2 lines on err := f(), <stmt> // for assignment with single lvalue Other punctuation is possible, e.g. on (err) <stmt> Now if we could just convince the Go gods to prototype this along with try() in 1.14 :-) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1b7ab9bd-0c1b-4658-8ee2-a36544b58f20%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.