title: Why does Go forbid taking the address of (&) map member, yet allows (&) slice element?
body: <p>Go doesn't allow taking the address of a map member:</p>
  
  <pre><code>// if I do this:
  p := &amp;mm["abc"]
  // Syntax Error - cannot take the address of mm["abc"]
  </code></pre>
  
  <p>The rationale is that if Go allows taking this address, when the map backstore grows or shinks, the address can become invalid, confusing the user.</p>
  
  <p>But Go slice gets relocated when it outgrows its capacity, yet, Go allows us to take the address of a slice element:</p>
  
  <pre><code> a := make([]Test, 5)
   a[0] = Test{1, "dsfds"}
   a[1] = Test{2, "sdfd"}
   a[2] = Test{3, "dsf"}
  
   addr1 := reflect.ValueOf(&amp;a[2]).Pointer()
   fmt.Println("Address of a[2]: ", addr1)
  
   a = append(a, Test{4, "ssdf"})
   addrx := reflect.ValueOf(&amp;a[2]).Pointer()
   fmt.Println("Address of a[2] After Append:", addrx)
  
   // Note after append, the first address is invalid
   Address of a[2]:  833358258224
   Address of a[2] After Append: 833358266416
  </code></pre>
  
  <p>Why is Go designed like this? What is special about taking address of slice element?</p>