title: Go variadic function argument passing
body: <p>I am trying to understand, What is difference between 1st and 2nd passing argument in function. In both case methods are functional and compiles. </p>
  
  <p>1)</p>
  
  <pre><code>generateReport(capacities...)
  
  func generateReport(capacities ...float64) {
      for i, cap := range capacities {
          fmt.Printf("Plant %d capacity %.0f\n", i, cap)
      }
  }
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>generateReport(plantCapacities)
  
  func generateReport(capacities []float64) {
      for i, cap := range capacities {
          fmt.Printf("Plant %d capacity %.0f\n", i, cap)
      }
  }
  </code></pre>
  
  <p><strong>Have found few good samples</strong> </p>
  
  <p>1) <a href="https://golangbot.com/variadic-functions/" rel="nofollow noreferrer">GolangBot - Variadic Function</a></p>
  
  <p>2) <a href="https://golang.org/ref/spec#Passing_arguments_to_..._parameters" rel="nofollow noreferrer">Golang.org - Passing arguments</a> as @Himanshu mentioned.</p>