title: Type converting slices of interfaces
body: <p>I'm curious why Go does't implicitly convert <code>[]T</code> to <code>[]interface{}</code> when it will implicitly convert <code>T</code> to <code>interface{}</code>.  Is there something non-trivial about this conversion that I'm missing?  </p>
  
  <p>Example:</p>
  
  <pre><code>func foo([]interface{}) { /* do something */ }
  
  func main() {
      var a []string = []string{"hello", "world"}
      foo(a)
  }
  </code></pre>
  
  <p><code>go build</code> complains </p>
  
  <blockquote>
    <p>cannot use a (type []string) as type []interface {} in function argument</p>
  </blockquote>
  
  <p>And if I try to do it explicitly, same thing: <code>b := []interface{}(a)</code> complains </p>
  
  <blockquote>
    <p>cannot convert a (type []string) to type []interface {}</p>
  </blockquote>
  
  <p>So every time I need to do this conversion (which seems to come up a lot), I've been doing something like this:</p>
  
  <pre><code>b = make([]interface{}, len(a), len(a))
  for i := range a {
      b[i] = a[i]
  }
  </code></pre>
  
  <p>Is there a better way to do this, or standard library functions to help with these conversions?  It seems kind of silly to write 4 extra lines of code every time I want to call a function that can take a list of e.g. ints or strings.</p>