title: How Go is memory safe?
body: <p>In the below code:</p>
  
  <pre><code>package main
  
  import "fmt"
  
  func main() {
      str := "abc"
      for i := 0; i &lt;= len(str); i++ {
          fmt.Println(str[i])
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Go allows to have invalid memory access until runtime:</p>
  
  <pre><code>$ bin/cs61a 
  97
  98
  99
  panic: runtime error: index out of range [3] with length 3
  
  Go fails to avoid invalid memory access until runtime.
  </code></pre>
  
  <hr>
  
  <p>How Go is memory safe to avoid invalid memory access?</p>