title: How to call the Scan variadic function using reflection
body: <p>I'm looking to call the <a href="http://golang.org/pkg/database/sql/#Rows.Scan" rel="noreferrer">Rows.Scan()</a> function using reflection.  However it takes a variable number of pointers, but there are not a lot of source examples.  I need to use reflection because I plan on filling a slice with the values from a Query call.  So basically using <code>rows.Columns()</code> to get the length of the row and then <code>make()</code> a slice of <code>[]interface{}</code> to fill with the data points that would normally be filled using the pointers passed to the <code>Scan()</code> function.</p>
  
  <p>Basically something like this code:</p>
  
  <pre><code>col := rows.Columns()
  vals := make([]interface{}, len(cols))
  rows.Scan(&amp;vals)
  </code></pre>
  
  <p>Anyone have an example of calling a variadic function that takes pointers using reflection that I can take a look at?</p>
  
  <p>Edit:
  Sample code that doesn't appear to do what I'm after.</p>
  
  <pre><code>package main
  
  import (
      _ "github.com/lib/pq"
      "database/sql"
      "fmt"
  )
  
  
  func main() {
  
      db, _ := sql.Open(
          "postgres",
          "user=postgres dbname=Go_Testing password=ssap sslmode=disable")
  
      rows, _ := db.Query("SELECT * FROM _users;")
  
      cols, _ := rows.Columns()
  
      for rows.Next() {
  
          data := make([]interface{}, len(cols))
  
          rows.Scan(data...)
  
          fmt.Println(data)
      }
  
  }
  </code></pre>
  
  <p>The results:</p>
  
  <pre><code>[&lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;]
  [&lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;]
  [&lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;]
  [&lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;]
  [&lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;]
  [&lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;]
  </code></pre>