title: Cannot assign to struct field in a map
body: <p>I have the data structure like this:</p>
  
  <pre><code>type Snapshot struct {
    Key   string
    Users []Users
  }
  
  snapshots := make(map[string] Snapshot, 1)
  
  // then did the initialization
  snapshots["test"] = Snapshot {
    Key: "testVal",
    Users: make([]Users, 0),
  }
  </code></pre>
  
  <p><code>Users</code> is another struct.</p>
  
  <p>Then when I tried to append some new <code>Users</code> values in the Users slice like this:</p>
  
  <pre><code>snapshots["test"].Users = append(snapshots["test"].Users, user)
  </code></pre>
  
  <p>I kept getting this error:</p>
  
  <pre class="lang-none prettyprint-override"><code>cannot assign to struct field snapshots["test"].Users in map
  </code></pre>
  
  <p>Also tried the workaround here <a href="https://github.com/golang/go/issues/3117" rel="noreferrer">https://github.com/golang/go/issues/3117</a> so like this:</p>
  
  <pre><code>tmp := snapshots["test"].Users
  tmp = append(tmp, user)
  snapshots["test"].Users = tmp
  </code></pre>
  
  <p>But no luck, still exactly same error.</p>
  
  <p>And also tried to declare the map with pointer, so: <code>snapshots := make(map[string] *Snapshot, 1)</code>, still no luck.</p>