反射
将[]interface{}中信息读取出来
func main() {
s := "abc"
var is []interface{}
//i := s
is = append(is, s)
fmt.Printf("is is %v\n", is)
val := reflect.ValueOf(is)
fmt.Printf("val type is %v, value is %v\n", val.Kind(), val)
switch val.Kind() {
case reflect.Slice:
for i := 0; i < val.Len(); i++{
e := val.Index(i).Interface()
fmt.Printf("e value is %v, type is %T\n", e, e)
}
}
}