News for hackers. Stuff that matters.
Re:Go 1.11 Beta 1 is released by erik_seaberg on Wednesday June 27, 2018 @01:59AM (#17406065)

  if err != nil {
          return nil, err
  }
is ceremony that requires no thought and adds no value. There should be sugar for this so it doesn't completely swamp the tiny minority of cases that actually do something.
Re:Go 1.11 Beta 1 is released by sacado2 on Wednesday June 27, 2018 @05:12AM (#17406771)
I actually rarely type that very snippet. In like 3/4 of the cases, I make the error more specific, like

    if err != nil {
        return nil, fmt.Errorf("could not parse file %s: %v", path, err)
    }
the remainder being either the snippet you put above or more complex error management.
Re:Go 1.11 Beta 1 is released by erik_seaberg on Friday June 29, 2018 @04:53AM (#17423282)
You can enrich err.Error(), but when you do you lose the type of the original error and any other fields it may have had. This is something the language can and should do more reliably (i.e., sugar could mutate err.Error() and prepend "MyStruct.myMethod failed: ", or better yet add a damn stack trace).
Re:Go 1.11 Beta 1 is released by cube2222 on Wednesday June 27, 2018 @09:48AM (#17408057)
I'm always using errors.Wrap or Wrapf otherwise it's hard to find the error cause.

I've just created a live template for that in Go, which just puts my cursor in the wrap message to pass along.

Re:Go 1.11 Beta 1 is released by stcredzero on Wednesday June 27, 2018 @12:08PM (#17409317)
is ceremony that requires no thought and adds no value.

Aw, hell no! That's a very easily detectable (anti)pattern! You can scan even a very large code base for that! As noted in other comments, you should be adding some contextual information at this point.

Contrast this with having too-much magic, where you might have absolutely no trace in code left. You can't usefully search a large code base for all such relevant blanks.

Re:Go 1.11 Beta 1 is released by sfifs on Wednesday June 27, 2018 @10:41AM (#17408486)
This is generally a bad idea in any production code. You normally want to add context to the error so that your logging captures the issue at the very minimum. You may want to do cleanup in the function etc. I almost never have written this style of code in many years now.