title: Defining golang struct function using pointer or not
body: <p>Can someone explain to me why appending to an array works when you do this:</p>
  
  <pre><code>func (s *Sample) Append(name string) {
      d := &amp;Stuff{
          name: name,
      }
      s.data = append(s.data, d)
  }
  </code></pre>
  
  <p><a href="http://play.golang.org/p/QCNEJG1nC9">Full code here</a></p>
  
  <p>But not when you do this:</p>
  
  <pre><code>func (s Sample) Append(name string) {
      d := &amp;Stuff{
          name: name,
      }
      s.data = append(s.data, d)
  }
  </code></pre>
  
  <p>Is there any reason at all why you would want to use the second example.</p>