News for hackers. Stuff that matters.
Re:Go 1.2 Release Candidate 1 released by AYBABTME on Friday September 20, 2013 @11:24AM (#6418287)
You might like:

   _, err := somethingThatFails(arg)
   if err != nil {
      return fmt.Errorf("failed with arg=%v, %v", arg, err)
   }
Now the use for this is not obvious from this toy example, but having a `printf`-like function that produces error is great to return errors with more context.

The difference from your example is that the info in `err` is not lost when passed up.

Re:Go 1.2 Release Candidate 1 released by benmanns on Friday September 20, 2013 @11:44AM (#6418418)
And you might like:

  if _, err := somethingThatFails(arg); err != nil {
    return fmt.Errorf("failed with arg=%v, %v", arg, err)
  }
Re:Go 1.2 Release Candidate 1 released by AYBABTME on Saturday September 21, 2013 @12:17AM (#6421968)
In that case I was ignoring the returned value for the sake of the example, otherwise you lose the declaration when it's in a `if`.
Re:Go 1.2 Release Candidate 1 released by sambeau on Friday September 20, 2013 @11:38AM (#6418386)
I do like that.

(I just picked (and cleaned up) the first piece of simple error code that I thought would be easy to use.)