title: How to compare errors in golang
body: <p>Context:
  I am doing unit tests and was trying to check if I got expected errors.</p>
  
  <p>I didn't have the expected result so I tried something simple which is comparing to exact errors and I was surprise that the comparison returned "false"
  </p>
  
  <pre><code>e1 := errors.New("error")
  e2 := errors.New("error")
  fmt.Println(e1 == e2) // false
  </code></pre>
  
  <p>Run Example: <a href="https://play.golang.org/p/cvjjiJT_5T" rel="nofollow noreferrer">https://play.golang.org/p/cvjjiJT_5T</a></p>
  
  <p>Can someone explain me <strong>why this returns false</strong> and how to properly check equality between errors ?</p>