get_struct.go 180 B

12345678910
  1. package utils
  2. import "reflect"
  3. func GetStruct(t reflect.Type) interface{} {
  4. if t.Kind() == reflect.Struct {
  5. return reflect.New(t).Interface()
  6. }
  7. return GetStruct(t.Elem())
  8. }