title: Is it safe to remove selected keys from map within a range loop?
body: <p>How can one remove selected keys from a map?
  Is it safe to combine <code>delete()</code> with range, as in the code below?</p>
  
  <pre><code>package main
  
  import "fmt"
  
  type Info struct {
      value string
  }
  
  func main() {
      table := make(map[string]*Info)
  
      for i := 0; i &lt; 10; i++ {
          str := fmt.Sprintf("%v", i)
          table[str] = &amp;Info{str}
      }
  
      for key, value := range table {
          fmt.Printf("deleting %v=&gt;%v\n", key, value.value)
          delete(table, key)
      }
  }
  </code></pre>
  
  <p><a href="https://play.golang.org/p/u1vufvEjSw" rel="noreferrer">https://play.golang.org/p/u1vufvEjSw</a></p>