title: How to set and get fields in struct's method
body: <p>After creating a struct like this:</p>
  
  <pre><code>type Foo struct {
      name string
  }
  
  func (f Foo) SetName(name string) {
      f.name = name
  }
  
  func (f Foo) GetName() string {
      return f.name
  }
  </code></pre>
  
  <p>How do I create a new instance of Foo and set and get the name?
  I tried the following:</p>
  
  <pre><code>p := new(Foo)
  p.SetName("Abc")
  name := p.GetName()
  
  fmt.Println(name)
  </code></pre>
  
  <p>Nothing gets printed, because name is empty. So how do I set and get a field inside a struct?</p>
  
  <p><a href="https://play.golang.org/p/_xkIc-n6Wbk" rel="noreferrer">Working playground</a></p>