title: Does dereferencing a struct return a new copy of struct?
body: <p>Why when we reference struct using <code>(*structObj)</code> does Go seem to return a new copy of <code>structObj</code> rather than return the same address of original <code>structObj</code>? This might be some misunderstanding of mine, so I seek clarification</p>
  
  <pre><code>package main
  
  import (
      "fmt"
  )
  
  type me struct {
      color string
      total int
  }
  
  func study() *me {
      p := me{}
      p.color = "tomato"
      fmt.Printf("%p\n", &amp;p.color)
      return &amp;p
  }
  
  func main() {
      p := study()
      fmt.Printf("&amp;p.color = %p\n", &amp;p.color)
  
      obj := *p
      fmt.Printf("&amp;obj.color = %p\n", &amp;obj.color)
      fmt.Printf("obj = %+v\n", obj)
  
      p.color = "purple"
      fmt.Printf("p.color = %p\n", &amp;p.color)
      fmt.Printf("p = %+v\n", p)
      fmt.Printf("obj  = %+v\n", obj)
  
      obj2 := *p
      fmt.Printf("obj2 = %+v\n", obj2)
  }
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>0x10434120
  &amp;p.color = 0x10434120
  &amp;obj.color = 0x10434140   //different than &amp;p.color!
  obj = {color:tomato total:0}
  p.color = 0x10434120
  p = &amp;{color:purple total:0}
  obj  = {color:tomato total:0}
  obj2 = {color:purple total:0} // we get purple now when dereference again
  </code></pre>
  
  <p><a href="https://play.golang.org/p/HCvajBAnsb" rel="noreferrer">Go playground</a> </p>