How to check the exact type of error in recover?
<p>I'm following this example here:</p>

<p><a href="https://www.socketloop.com/tutorials/golang-smarter-error-handling-with-strings-contains-function" rel="nofollow">https://www.socketloop.com/tutorials/golang-smarter-error-handling-with-strings-contains-function</a></p>

<pre><code> if !strings.Contains(err.Error(), "timed out") {
    fmt.Printf("resulting error not a timeout: %s", err)
 }
</code></pre>

<p>However, if I do that in my code I will get this</p>

<blockquote>
  <p>err.Error undefined (type interface {} is interface with no methods)</p>
</blockquote>

<p>I wonder what I'm doing wrong here, and how should I check for an exact error (in my case I want to recover from the error "slice bounds out of range")</p>

<p>Best,</p>