title: Golang basics struct and new() keyword
body: <p>I was learning golang, and as I was going through the chapter that describes Structures, I came across different ways to initialize structures. </p>
  
  <pre><code>p1 := passport{}
  var p2 passport
  p3 := passport{
      Photo: make([]byte, 0, 0),
      Name: "Scott",
      Surname: "Adam",
      DateOfBirth: "Some time",
  }
  
  fmt.Printf("%s\n%s\n%s\n", p1, p2, p3)
  </code></pre>
  
  <p>While these print the values of the structures as</p>
  
  <p><code>{   }
  {   }
  { Scott Adam Some time}</code>
  , the following code below prints with an ampersand because it is a reference.</p>
  
  <pre><code>pointerp1 := &amp;p3
  fmt.Printf("%s", pointerp1)
  pointerp2 := new(passport)
  pointerp2.Name = "Anotherscott"
  fmt.Printf("%s", pointerp2)
  </code></pre>
  
  <p><code>&amp;{ Scott Adam Some time}&amp;{ Anotherscott  }</code></p>
  
  <p>Kindly help me with my doubts.</p>
  
  <ol>
  <li><p>in the usage <code>pointerp1 := &amp;p3</code>, <code>pointerp1</code> is the reference variable to <code>p3</code>, which holds the actual data. Similarly, what would be the actual variable that holds the data for <code>pointerp2</code>?</p></li>
  <li><p>What would be the best scenarios to use these different types of initialization?</p></li>
  </ol>