title: Why are map values not addressable?
body: <p>While playing with Go code, I found out that map values are not addressable. For example,</p>
  
  <pre><code>package main
  import "fmt"
  
  func main(){
      var mymap map[int]string = make(map[int]string)
      mymap[1] = "One"
      var myptr *string = &amp;mymap[1]
      fmt.Println(*myptr)
  }
  </code></pre>
  
  <p>Generates error</p>
  
  <blockquote>
    <p>mapaddressable.go:7: cannot take the address of mymap[1]</p>
  </blockquote>
  
  <p>Whereas, the code,</p>
  
  <pre><code>package main
  import "fmt"
  
  func main(){
      var mymap map[int]string = make(map[int]string)
      mymap[1] = "One"
      mystring := mymap[1]
      var myptr *string = &amp;mystring
      fmt.Println(*myptr)
  }
  </code></pre>
  
  <p>works perfectly fine.</p>
  
  <p>Why is this so? Why have the Go developers chosen to make certain values not addressable? Is this a drawback or a feature of the language?</p>
  
  <p><strong>Edit</strong>:
  Being from a C++ background, I am not used to this <code>not addressable</code> trend that seems to be prevalent in Go. For example, the following code works just fine:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;map&gt;
  #include&lt;string&gt;
  using namespace std;
  int main(){
      map&lt;int,string&gt; mymap;
      mymap[1] = "one";
      string *myptr = &amp;mymap[1];
      cout&lt;&lt;*myptr;
  }
  </code></pre>
  
  <p>It would be nice if somebody could point out why the same <em>addressability</em> cannot be achieved (or intentionally wasn't achieved) in Go.</p>