title: How to check if a slice has a given index in Go?
body: <p>We can easily do that with maps:</p>
  
  <pre><code>item, ok := myMap["index"]
  </code></pre>
  
  <p>But not with slices:</p>
  
  <pre><code>item, ok := mySlice[3] // panic!
  </code></pre>
  
  <p>Surprised this wasn't asked before. Maybe I'm on the wrong mental model with Go slices?</p>