Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Regarding 1, I (and seemingly everyone else writing libraries) usually return (value, error) and treat a nil value as error. We have quite a bit of old code at work that might segfault because it wasn't done like this.

Most of our Kubernetes code looks something like this

    _, err := clientInterface.Update(object)
    if err != nil {
      if machinery_errors.IsNotFound(err) {
        //handle nil case
      } else
        // handle unexpected case
      }
    }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: