title: What is the difference between passing a struct and pointer of the struct, are they not both pointers?
body: <p>For example</p>
  
  <pre><code>var myStructRef *Vertex
  var myStruct Vertex
  myStructRef = &amp;Vertex{2, 3}
  myStruct = Vertex{2, 3}
  
  fmt.Println(myStructRef)
  fmt.Println(myStruct)
  changeByReferenceStruct(myStructRef)
  changeByValueStruct(myStruct)
  fmt.Println(myStructRef)
  fmt.Println(myStruct)
  </code></pre>
  
  <p>And </p>
  
  <pre><code>func changeByValueStruct(myStruct Vertex) {
      myStruct.X = 5
      fmt.Println(myStruct)
  }
  
  
  func changeByReferenceStruct(myStruct *Vertex) {
      myStruct.X = 7
      fmt.Println(myStruct)
  }
  </code></pre>
  
  <p>Isn't both <code>myStructRef *Vertex</code> and <code>myStruct Vertex</code> a pointer pointing to the struct itself? Why is there a discrepancy in behavior when I modify the struct in a function?</p>
  
  <p>Is golang creating a new struct in <code>changeByValueStruct</code> when it resolves the parameter?</p>