News for hackers. Stuff that matters.
Re:Go 1.2 Release Candidate 1 released by jawr on Friday September 20, 2013 @10:48AM (#6418029)
If it's a fairly big function, or a common way of dealing with errors in a package you can always define a func (nested or not):

  func foo() error {
    handleErr = func(err error) bool {
      if err != nil {
         log.Println(err)
         // do other stuff
         return true
      }
      return false
    }
    err := bar()
    if handleErr(err) { return err }
  }
It's nice and concise.

There are no comments on this comment yet.