title: How to use go-sqlmock WithArgs() with a variable number of arguments?
body: <p>I use go-sqlmock (<a href="https://godoc.org/github.com/DATA-DOG/go-sqlmock" rel="noreferrer">https://godoc.org/github.com/DATA-DOG/go-sqlmock</a>) to test a function that receives a variable number of arguments (I simplified the function for the sake of simplicity and stripped out most of the code):</p>
  
  <pre><code>func getHits(db *sql.DB, actions ...string) (hits []Hit, err error) {
     // ...
     query := `select * from table where action in (?,?)`
     rows, err := db.Query(query, actions)
     // ...
  }
  </code></pre>
  
  <p>The tests look like that:</p>
  
  <pre><code>// rows := ...
  actions := []string{"click", "event"}
  mock.ExpectQuery(`^select .*`).WithArgs(actions).WillReturnRows(rows)
  hits, err := getHits(db, actions...)
  if mockErr := mock.ExpectationsWereMet(); mockErr != nil {
      log.Fatalf("there were unfulfilled expections: %s", mockErr)
  }
  </code></pre>
  
  <p>Then I get this output:</p>
  
  <pre><code>2017/12/21 10:38:23 there were unfulfilled expections: there is a remaining expectation which was not matched: ExpectedQuery =&gt; expecting Query or QueryRow which:
  - matches sql: '^select .*'
  - is with arguments:
    0 - [click event]
  - should return rows: ...
  </code></pre>
  
  <p>If I change the tests like this:</p>
  
  <pre><code>mock.ExpectQuery(`^select .*`).WithArgs(actions[0], actions[1]).WillReturnRows(rows)
  </code></pre>
  
  <p>Then I get this output:</p>
  
  <pre><code>2017/12/21 10:44:41 there were unfulfilled expections: there is a remaining expectation which was not matched: ExpectedQuery =&gt; expecting Query or QueryRow which:
  - matches sql: '^select .*'
  - is with arguments:
    0 - click
    1 - event
  - should return rows:
  </code></pre>
  
  <p>The only I can make it pass is by calling :</p>
  
  <pre><code>db.Query(query, actions[0], actions[1])
  </code></pre>
  
  <p>which is what I obviously don't want to do as I don't know the number of actions...</p>
  
  <p>Does anyone have an idea on how I could fix or debug this ?</p>