title: Golang: get the type of slice
body: <p>I am using reflect package to get the type of arbitrary array, but getting </p>
  
  <pre><code>   prog.go:17: cannot use sample_array1 (type []int) as type []interface {} in function argument [process exited with non-zero status]
  </code></pre>
  
  <p>How do I get the type from array?  I know how to get it from value.</p>
  
  <pre><code>  func GetTypeArray(arr []interface{}) reflect.Type {
        return reflect.TypeOf(arr[0])
    }
  </code></pre>
  
  <p><a href="http://play.golang.org/p/sNw8aL0a5f" rel="noreferrer">http://play.golang.org/p/sNw8aL0a5f</a></p>