title: Change values while iterating
body: <p>Let's suppose I have these types:</p>
  
  <pre><code>type Attribute struct {
      Key, Val string
  }
  type Node struct {
      Attr []Attribute
  }
  </code></pre>
  
  <p>and that I want to iterate on my node's attributes to change them.</p>
  
  <p>I would have loved to be able to do:</p>
  
  <pre><code>for _, attr := range n.Attr {
      if attr.Key == "href" {
          attr.Val = "something"
      }
  }
  </code></pre>
  
  <p>but as <code>attr</code> isn't a pointer, this wouldn't work and I have to do:</p>
  
  <pre><code>for i, attr := range n.Attr {
      if attr.Key == "href" {
          n.Attr[i].Val = "something"
      }
  }
  </code></pre>
  
  <p>Is there a simpler or faster way? Is it possible to directly get pointers from <code>range</code>?</p>
  
  <p>Obviously I don't want to change the structures just for the iteration and more verbose solutions are no solutions.</p>