title: Assign a new value to a struct field
body: <p>I have a problem with structure fields.</p>
  
  <p>I've created a class <code>Point</code> with one method <code>Move()</code> that increases or decreases object variable <code>x</code> by <code>dx</code>. Another method <code>Print</code> is used to output results.</p>
  
  <p>In <code>main()</code> a new instance is created with default <code>x = 3</code> and <code>dx = 2</code>, then I call <code>Move()</code> and <code>Print()</code>. I expect that value of <code>x</code> is changed during <code>Move()</code> and <code>Print()</code> will produce <code>Final x=5</code>, but instead of it displays this:</p>
  
  <pre><code>2014/07/28 15:49:44 New X=5
  2014/07/28 15:49:44 Final X=3
  </code></pre>
  
  <p>What's wrong with my code?</p>
  
  <pre class="lang-golang prettyprint-override"><code>type Point struct {
    x, dx int
  }
  
  func (s Point) Move() {
    s.x += s.dx
    log.Printf("New X=%d", s.x)
  }
  
  func (s Point) Print() {
    log.Printf("Final X=%d", s.x)
  }
  
  func main() {
    st := Point{ 3, 2 };
    st.Move()
    st.Print()
  }
  </code></pre>