title: Golang MySQL querying undefined amount of args using IN operator
body: <p>I'm trying to use a MySQL query using the IN operator with undefined amount of arguments into my Golang project.</p>
  
  <p>I'm using the package <code>github.com/go-sql-driver/mysql</code> and tried to build my solution on this Stackoverflow answer : <a href="https://stackoverflow.com/questions/20271123/how-to-execute-an-in-lookup-in-sql-using-golang?answertab=votes#tab-top">How to execute an IN lookup in SQL using Golang?</a></p>
  
  <p>I've read some similar posts giving me some advices about the way to go, but I'm stuck on the execution part of the query, because it does not allow the direct use of a slice as argument.</p>
  
  <pre><code>//converting my form args []string into []int
  var args []int
  for _, v := range r.Form["type"] {
      t, _ := strconv.Atoi(v)
      args = append(args, t)
  }
  
  sql := "SELECT id, name FROM resources WHERE id IN (SELECT resource_id FROM resources_types WHERE type_id IN (?" + strings.Repeat(",?", len(args)-1) + "))"
  fmt.Println("Query : ", sql)
  stmt, _ := db.Prepare(sql)
  rows, err := stmt.Query(args)
  defer stmt.Close()
  </code></pre>
  
  <p>Golang returns me an error at execution :</p>
  
  <blockquote>
    <p>Query : SELECT id, name FROM resources WHERE id IN (SELECT resource_id
    FROM resources_types WHERE type_id IN (?,?)) 
    "sql: statement expects 2 inputs; got 1"</p>
  </blockquote>
  
  <p>It works when I try with </p>
  
  <pre><code>rows, err := stmt.Query(args[0], args[1])
  </code></pre>
  
  <p>But as I need an undefined number of arguments, it isn't a solution. Is it at least possible to get it working with MySQL ?</p>