[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread xjru
> > But you're not going to get any new syntax accepted by the go team anyway, > certainly not a new operator. You know that already. > I don't know that at all. I'm just putting an idea out there. They may well consider it or it may inspire other ideas on their part, who knows? -- You recei

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread xjru
As I said, this syntax doesn't help, because it puts file into the scope of the if block where we often don't want it. Reformatting it doesn't change that. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread xjru
As I said, this syntax puts file into the scope of the if block where. Reformatting it doesn't change that. -- 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 gola

[go-nuts] Proposal for a succinct error return syntax

2017-01-05 Thread xjru
Here are some examples for valid error returns according to my proposal: file, err := os.Open(fname) ||| return err file, err := os.Open(fname) ||| panic(err) file, err := os.Open(fname) ||| return errors.Wrap(err, "too bad") The third example uses the Wrap function from github.com/pkg/errors