title: Function is not changing the pointer after return
body: <p>Language is 'Go' ('Golang').</p>
  
  <p>The Function <code>initApp</code> is receiving a Pointer to an Object ('struct' in Go).
  Inside the Function I create a new Object Pointer and initialize the Value of the Object. Printing and Debugger both show that before the Function's Return everything is good.
  But after the Return, the Pointer which was the Function's Argument has the same empty Value as before the Function Call.</p>
  
  <p>Why is that so?</p>
  
  <p>Code is here:
  <a href="https://pastebin.com/0Gww2CQC" rel="nofollow noreferrer">https://pastebin.com/0Gww2CQC</a></p>
  
  <pre><code>// ptr.go.
  
  package main
  
  import "fmt"
  
  type ClassX struct {
      Name string
      Age  int
  }
  
  func main() {
      var obj *ClassX
      initApp(obj)
      fmt.Println(obj)
      return
  }
  
  func initApp(x *ClassX) {
      tmp := NewClassXObject()
      x = tmp
      fmt.Println("tmp:", tmp)
      fmt.Println("x:", x)
  }
  
  func NewClassXObject() *ClassX {
      x := new(ClassX)
      x.init()
      return x
  }
  
  func (o *ClassX) init() {
      o.Age = 123
      o.Name = "John"
  }
  </code></pre>
  
  <p>The Output is following:</p>
  
  <p><code>tmp: &amp;{John 123}
  x: &amp;{John 123}
  &lt;nil&gt;</code></p>
  
  <p>Thank You!</p>