原文地址声明:https://blog.csdn.net/qq_23179075/article/details/104295201
Go反射使用记录
type User struct {
Name string
Age int
}
1. 通过反射方法reflect.New()创建实例
通过reflect.New()创建的实例,总是返回的是实例指针类型。
func ReflectNew(arg interface{}) interface{} {
if arg == nil {
return nil
}
typeOf := reflect.TypeOf(arg)
/