title: Go - void function and direct assignment
body: <p>I have a little problem in Go language.
  I have this struct:</p>
  
  <pre><code>type Time struct{
      hour,min,sec int
  }
  </code></pre>
  
  <p>And this function that initializes it:</p>
  
  <pre><code>func init_Time(t Time) (int,int,int){
      t.hour, t.min, t.sec = time.Now().Clock()
      return t.hour, t.min, t.sec
  }
  </code></pre>
  
  <p>And the <code>main</code> is:</p>
  
  <pre><code>func main(){
     var Tm Time
     Tm.hour, Tm.min, Tm.sec = init_Time(Tm)
     fmt.Printf("Time: %d:%d:%d", Tm.hour, Tm.min, Tm.sec)
  } 
  </code></pre>
  
  <p>I have imported <code>time</code> package too. It works perfectly but I have 2 questions about it:</p>
  
  <ol>
  <li><p>In my code, why is the assignment to the variables (hour,min,sec) twice done both in the <code>init_Time</code> function:</p>
  
  <p>t.hour, t.min, t.sec = time.Now().Clock()</p></li>
  </ol>
  
  <p>and in the <code>main()</code>:</p>
  
  <pre><code>Tm.hour, Tm.min, Tm.sec = init_Time(Tm)
  </code></pre>
  
  <p>Is it necessary or is my mistake?</p>
  
  <ol start="2">
  <li>Why if I modify the <code>init_Time</code> function by transforming it into a void function, it returns values <code>"Time: 0:0:0"</code> instead of the current time?</li>
  </ol>
  
  <p>(Example:)</p>
  
  <pre><code>func init_Time(t Time) {
        t.hour, t.min, t.sec = time.Now().Clock()
  }
  ...
  func main(){
       var Tm Time
       init_Time(Tm)
       fmt.Printf("Time: %d:%d:%d", Tm.hour, Tm.min, Tm.sec)
  } 
  </code></pre>