title: How to create slice of struct using reflection?
body: <p>I need to create a slice of struct from its interface with reflection.</p>
  
  <p>I used Reflection because do not see any other solution without using it.</p>
  
  <p>Briefly, the function receives variadic values of Interface.</p>
  
  <p>Then, with reflection creates slice and passes it into another function.</p>
  
  <p>Reflection asks to type assertion</p>
  
  <pre><code>SliceVal.Interface().(SomeStructType)
  </code></pre>
  
  <p>But, I cannot use it.</p>
  
  <p>Code in playground <a href="http://play.golang.org/p/EcQUfIlkTe">http://play.golang.org/p/EcQUfIlkTe</a>    </p>
  
  <p>The code:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "reflect"
  )
  
  type Model interface {
      Hi()
  }
  
  type Order struct {
      H string
  }
  
  func (o Order) Hi() {
      fmt.Println("hello")
  }
  
  func Full(m []Order) []Order{
      o := append(m, Order{H:"Bonjour"}
      return o
  }
  
  func MakeSlices(models ...Model) {
      for _, m := range models {
          v := reflect.ValueOf(m)
          fmt.Println(v.Type())
          sliceType := reflect.SliceOf(v.Type())
          emptySlice := reflect.MakeSlice(sliceType, 1, 1)
          Full(emptySlice.Interface())
      }
  }
  func main() {
      MakeSlices(Order{})
  }
  </code></pre>