title: Is function parameter validation using errors a good pattern in Go?
body: <p>Is parameter validation using error return codes considered good practice ? I mean where should somebody use errors vs panics (are there any guidelines?).</p>
  
  <p>For instance: </p>
  
  <ul>
  <li>Is checking for non-nil + returning an error if it is nil a good
  practice ?</li>
  <li>Or checking for correct integer ranges etc.</li>
  </ul>
  
  <p>I imagine that using errors that often would make Go feel very C-ish and would look pretty bad. Are panics a good alternative in those situations ?</p>
  
  <p>Or should a Gopher use the Python/Ruby/JS-approach "just let it fail" ?</p>
  
  <p>I'm a bit confused because panics are for real "errors" in my understanding. But using errors all the time is just <em>bad</em>. </p>
  
  <p>And even if I would return error code: What could I do if somebody passes wrong parameter to my function but ignores the errors codes ? -> Nothing! So honestly I would say panics are nice for those situations but in a language where error codes are used over panics this is not very clear.</p>