diff --git a/DependencyInjection/ServiceCollection.go b/DependencyInjection/ServiceCollection.go index 6a7556cc..f07a54ed 100644 --- a/DependencyInjection/ServiceCollection.go +++ b/DependencyInjection/ServiceCollection.go @@ -1,7 +1,7 @@ package DependencyInjection import ( - "github.com/yoyofx/yoyogo/Utils/Reflect" + "github.com/yoyofxteam/reflectx" "strings" ) @@ -18,7 +18,7 @@ func NewServiceCollection() *ServiceCollection { //Scoped //Transient func (sc *ServiceCollection) AddServiceDescriptor(sd *ServiceDescriptor) { - typeName, _ := Reflect.GetCtorFuncOutTypeName(sd.Provider) + typeName, _ := reflectx.GetCtorFuncOutTypeName(sd.Provider) typeName = strings.ToLower(typeName) index := len(sc.serviceDescriptors) defIndex, exist := sc.serviceDescriptorMaps[typeName] diff --git a/Test/reflect_test.go b/Test/reflect_test.go index 4b5be3a2..f6723e00 100644 --- a/Test/reflect_test.go +++ b/Test/reflect_test.go @@ -4,13 +4,101 @@ import ( "fmt" "github.com/stretchr/testify/assert" "github.com/yoyofx/yoyogo/Examples/SimpleWeb/contollers" - "github.com/yoyofx/yoyogo/Utils" - "github.com/yoyofx/yoyogo/Utils/Reflect" + "github.com/yoyofx/yoyogo/Examples/SimpleWeb/models" "github.com/yoyofx/yoyogo/WebFramework/Context" - "github.com/yoyofx/yoyogo/WebFramework/Mvc" + "github.com/yoyofxteam/reflectx" + "reflect" + "strings" "testing" ) +// +//import ( +// "fmt" +// "github.com/stretchr/testify/assert" +// "github.com/yoyofx/yoyogo/Examples/SimpleWeb/contollers" +// "github.com/yoyofx/yoyogo/Utils" +// "github.com/yoyofx/yoyogo/Utils/Reflect" +// "github.com/yoyofx/yoyogo/WebFramework/Context" +// "github.com/yoyofx/yoyogo/WebFramework/Mvc" +// "github.com/yoyofxteam/reflectx" +// "testing" +//) +// +//type Person struct { +// Name string +// Student *Student +//} +// +//type Student struct { +// Name string `json:"name"` +// Age int `json:"age"` +// Grade int `json:"grade"` +//} +// +//func (typeInfo Student) Hello() string { +// return "hello" +//} +// +//func (typeInfo Student) Say(hi string) string { +// return "Hello " + hi +//} +// +//func Test_MethodCallerCall2(t *testing.T) { +// utype := &UserInfo{} +// +// methodInfo, _ := reflectx.GetObjectMethodInfoByName(utype, "Hello") +// results := methodInfo.Invoke(&Context.HttpContext{}, "hello world!") +// +// fmt.Println() +// fmt.Printf("Result: %s", results) +// fmt.Println() +// +// assert.Equal(t, results[0].(string), "hello world!") +//} +// +//func Test_RecCreateStruct(t *testing.T) { +// //yourtype := reflect.TypeOf(Mvc.RequestBody{}) +// //dd := Reflect.CreateInstance(yourtype) +// //_ = dd +// typeInfo, _ := Reflect.GetTypeInfo(Mvc.RequestBody{}) +// ins := typeInfo.CreateInstance() +// assert.Equal(t, ins != nil, true) +//} +// +//func Test_GetCtorFuncTypeName(t *testing.T) { +// ctorFunc := contollers.NewUserController +// name, _ := Reflect.GetCtorFuncOutTypeName(ctorFunc) +// name = Utils.LowercaseFirst(name) +// assert.Equal(t, name, "userController") +//} +// +//func Test_ReflectStructFields(t *testing.T) { +// student := &Student{ +// Name: "json", +// Age: 18, +// Grade: 9, +// } +// p := Person{ +// Name: "Json", +// Student: student, +// } +// +// ptype, _ := Reflect.GetTypeInfo(p) +// pf1 := ptype.GetFieldByName("Name") +// assert.Equal(t, pf1.GetValue(), "Json") +// pf2 := ptype.GetFieldByName("Student") +// assert.Equal(t, pf2.GetValue(), student) +// typeInfo, _ := pf2.AsTypeInfo() +// +// typeInfo.GetFieldByName("Grade").SetValue(11) +// assert.Equal(t, student.Grade, 11) +// assert.Equal(t, typeInfo.HasMethods(), true) +// sayRet := typeInfo.GetMethodByName("Say").Invoke("World!")[0].(string) +// assert.Equal(t, sayRet, "Hello World!") +// +//} + type Person struct { Name string Student *Student @@ -23,64 +111,64 @@ type Student struct { } func (typeInfo Student) Hello() string { + fmt.Println("hello ") return "hello" } func (typeInfo Student) Say(hi string) string { + fmt.Println("Hello " + hi) return "Hello " + hi } -func Test_MethodCallerCall2(t *testing.T) { - utype := &UserInfo{} - - methodInfo, _ := Reflect.GetObjectMethodInfoByName(utype, "Hello") - results := methodInfo.Invoke(&Context.HttpContext{}, "hello world!") - - fmt.Println() - fmt.Printf("Result: %s", results) - fmt.Println() - - assert.Equal(t, results[0].(string), "hello world!") -} +func Test_GetStructMethodList(t *testing.T) { + userInfo := &UserInfo{} + userMethodList := reflectx.GetObjectMethodInfoList(userInfo) + assert.Equal(t, len(userMethodList), 2) + assert.Equal(t, getMehtodInfoByName(userMethodList, "Hello").Invoke(userInfo, &Context.HttpContext{}, "UserInfo Func Call:Hello,")[0], + "UserInfo Func Call:Hello,") + //--------------------------------------------------------------------------------------------- + student := Student{} + studentMethodList := reflectx.GetObjectMethodInfoList(student) + assert.Equal(t, len(studentMethodList), 2) + assert.Equal(t, studentMethodList[0].Name, "Hello") + assert.Equal(t, studentMethodList[1].Name, "Say") -func Test_RecCreateStruct(t *testing.T) { - //yourtype := reflect.TypeOf(Mvc.RequestBody{}) - //dd := Reflect.CreateInstance(yourtype) - //_ = dd - typeInfo, _ := Reflect.GetTypeInfo(Mvc.RequestBody{}) - ins := typeInfo.CreateInstance() - assert.Equal(t, ins != nil, true) + assert.Equal(t, getMehtodInfoByName(studentMethodList, "Hello").Invoke(student)[0], "hello") + assert.Equal(t, getMehtodInfoByName(studentMethodList, "Say").Invoke(student, "Say: Student")[0], "Hello Say: Student") } -func Test_GetCtorFuncTypeName(t *testing.T) { - ctorFunc := contollers.NewUserController - name, _ := Reflect.GetCtorFuncOutTypeName(ctorFunc) - name = Utils.LowercaseFirst(name) - assert.Equal(t, name, "userController") -} - -func Test_ReflectStructFields(t *testing.T) { - student := &Student{ - Name: "json", - Age: 18, - Grade: 9, - } - p := Person{ - Name: "Json", - Student: student, +func getMehtodInfoByName(infos []reflectx.MethodInfo, name string) reflectx.MethodInfo { + for _, m := range infos { + if m.Name == name { + return m + } } + return infos[0] +} - ptype, _ := Reflect.GetTypeInfo(p) - pf1 := ptype.GetFieldByName("Name") - assert.Equal(t, pf1.GetValue(), "Json") - pf2 := ptype.GetFieldByName("Student") - assert.Equal(t, pf2.GetValue(), student) - typeInfo, _ := pf2.AsTypeInfo() +func Test_UserController(t *testing.T) { + controllerCtor := contollers.NewUserController + controllerName, controllerType := reflectx.GetCtorFuncOutTypeName(controllerCtor) + controllerName = strings.ToLower(controllerName) + // Create Controller and Action descriptors - typeInfo.GetFieldByName("Grade").SetValue(11) - assert.Equal(t, student.Grade, 11) - assert.Equal(t, typeInfo.HasMethods(), true) - sayRet := typeInfo.GetMethodByName("Say").Invoke("World!")[0].(string) - assert.Equal(t, sayRet, "Hello World!") + instance := reflect.New(controllerType).Interface() + actionList := reflectx.GetObjectMethodInfoList(instance) + mi := getMehtodInfoByName(actionList, "GetUserName") + _ = mi.Parameters[0].ParameterType.Elem().Name() + rets := mi.Invoke(instance, &Context.HttpContext{}, &contollers.RegisterRequest{ + UserName: "he", + Password: "123", + }) + assert.Equal(t, len(rets), 1) + instance1 := contollers.NewUserController(models.NewUserAction()) + _ = instance1 + //actionList = reflectx.GetObjectMethodInfoList(instance) + //_ = actionList + //mi = getMehtodInfoByName(actionList,"GetUserName") + //mi.Invoke(instance,&Context.HttpContext{}, &contollers.RegisterRequest{ + // UserName: "he", + // Password: "123", + //}) } diff --git a/Test/structtag_test.go b/Test/structtag_test.go index c5238c07..5b87b759 100644 --- a/Test/structtag_test.go +++ b/Test/structtag_test.go @@ -2,8 +2,6 @@ package Test import ( "fmt" - "github.com/magiconair/properties/assert" - "github.com/yoyofx/yoyogo/Utils/Reflect" "github.com/yoyofx/yoyogo/WebFramework/Context" "reflect" "testing" @@ -55,18 +53,6 @@ func reflectCall(ctype interface{}, funcName string, params ...interface{}) inte return nil } -func Test_MethodCallerCall(t *testing.T) { - utype := &UserInfo{} - method := Reflect.NewMethodCaller(utype, "Hello") - results := method.Invoke(&Context.HttpContext{}, "hello world!") - - fmt.Println() - fmt.Printf("Result: %s", results) - fmt.Println() - - assert.Equal(t, results[0].(string), "hello world!") -} - func Test_StructGetFieldTag(t *testing.T) { user := &UserInfo{"John Doe The Fourth", 20} diff --git a/Utils/Reflect/FieldInfo.go b/Utils/Reflect/FieldInfo.go deleted file mode 100644 index 9661a5c5..00000000 --- a/Utils/Reflect/FieldInfo.go +++ /dev/null @@ -1,35 +0,0 @@ -package Reflect - -import ( - "errors" - "reflect" -) - -// FieldInfo : field info -type FieldInfo struct { - Name string - Type reflect.Type - Kind reflect.Kind - Tags reflect.StructTag - Value reflect.Value -} - -// SetValue : set value to field, field must be kind of reflect.Ptr -func (field FieldInfo) SetValue(v interface{}) { - if field.Value.CanSet() { - field.Value.Set(reflect.ValueOf(v)) - } -} - -// GetValue : get value of field -func (field FieldInfo) GetValue() interface{} { - return field.Value.Interface() -} - -// AsTypeInfo : convert field to TypeInfo -func (field FieldInfo) AsTypeInfo() (TypeInfo, error) { - if field.Kind == reflect.Struct || field.Kind == reflect.Ptr { - return GetTypeInfoWithValueType(field.Value, field.Type) - } - return TypeInfo{}, errors.New("must be struct") -} diff --git a/Utils/Reflect/MethodCaller.go b/Utils/Reflect/MethodCaller.go deleted file mode 100644 index d5a236a0..00000000 --- a/Utils/Reflect/MethodCaller.go +++ /dev/null @@ -1,62 +0,0 @@ -package Reflect - -import "reflect" - -type MethodCaller struct { - Object interface{} - MethodName string - methodInfo reflect.Value - paramsNum int - paramTypes []reflect.Type - paramValues []reflect.Value - foundMethod bool -} - -func NewMethodCaller(obj interface{}, funcName string) *MethodCaller { - caller := &MethodCaller{ - Object: obj, - MethodName: funcName, - } - caller.foundMethod = caller.findMethod() - if caller.foundMethod { - return caller - } - return nil -} - -func (method *MethodCaller) GetParamTypes() []reflect.Type { - return method.paramTypes -} - -func (method *MethodCaller) findMethod() bool { - t := reflect.ValueOf(method.Object) - method.methodInfo = t.MethodByName(method.MethodName) - if !method.methodInfo.IsValid() { - return false - } - methodType := method.methodInfo.Type() - - method.paramsNum = methodType.NumIn() - method.paramTypes = make([]reflect.Type, method.paramsNum) - - for idx := 0; idx < method.paramsNum; idx++ { - method.paramTypes[idx] = methodType.In(idx) - } - return true -} - -func (method *MethodCaller) Invoke(params ...interface{}) []interface{} { - method.paramValues = make([]reflect.Value, method.paramsNum) - for idx := 0; idx < method.paramsNum; idx++ { - method.paramValues[idx] = reflect.ValueOf(params[idx]) - } - returns := method.methodInfo.Call(method.paramValues) - outNum := method.methodInfo.Type().NumOut() - results := make([]interface{}, outNum) - if len(returns) > 0 { - for i, res := range returns { - results[i] = res.Interface() - } - } - return results -} diff --git a/Utils/Reflect/MethodInfo.go b/Utils/Reflect/MethodInfo.go deleted file mode 100644 index 250b9cc5..00000000 --- a/Utils/Reflect/MethodInfo.go +++ /dev/null @@ -1,49 +0,0 @@ -package Reflect - -import ( - "reflect" -) - -// Method Info -type MethodInfo struct { - Name string //Method Name - MethodInfoVal reflect.Value //method value - MethodInfoType reflect.Type //method type - Parameters []ParameterInfo //method's Parameters - OutType reflect.Type //function's return type. -} - -// IsValid : method is valid -func (method MethodInfo) IsValid() bool { - return method.MethodInfoVal.IsValid() -} - -// Invoke : invoke the method with interface params. -func (method MethodInfo) Invoke(params ...interface{}) []interface{} { - paramsCount := len(method.Parameters) - paramsValues := make([]reflect.Value, paramsCount) - for idx := 0; idx < paramsCount; idx++ { - method.Parameters[idx].ParameterValue = reflect.ValueOf(params[idx]) - paramsValues[idx] = method.Parameters[idx].ParameterValue - } - - return method.InvokeWithValue(paramsValues...) -} - -// InvokeWithValue: invoke the method with value params. -func (method MethodInfo) InvokeWithValue(paramsValues ...reflect.Value) []interface{} { - returns := method.MethodInfoVal.Call(paramsValues) - outNum := method.MethodInfoType.NumOut() - results := make([]interface{}, outNum) - if len(returns) > 0 { - for i, res := range returns { - results[i] = res.Interface() - } - } - return results -} - -// AsTypeInfo : convert method to TypeInfo -func (method MethodInfo) AsTypeInfo() (TypeInfo, error) { - return GetTypeInfoWithValueType(method.MethodInfoVal, method.MethodInfoType) -} diff --git a/Utils/Reflect/ParameterInfo.go b/Utils/Reflect/ParameterInfo.go deleted file mode 100644 index 1fa49e54..00000000 --- a/Utils/Reflect/ParameterInfo.go +++ /dev/null @@ -1,11 +0,0 @@ -package Reflect - -import ( - "reflect" -) - -type ParameterInfo struct { - Name string - ParameterType reflect.Type - ParameterValue reflect.Value -} diff --git a/Utils/Reflect/ReflectHelper.go b/Utils/Reflect/ReflectHelper.go deleted file mode 100644 index 54a279d9..00000000 --- a/Utils/Reflect/ReflectHelper.go +++ /dev/null @@ -1,78 +0,0 @@ -package Reflect - -import ( - "reflect" -) - -// CreateInstance create new instance by type -func CreateInstance(objectType reflect.Type) interface{} { - var ins reflect.Value - - ins = reflect.New(objectType) - - if objectType.Kind() == reflect.Struct { - ins = ins.Elem() - } - - return ins.Interface() -} - -// GetCtorFuncOutTypeName get ctor function return type's name. -func GetCtorFuncOutTypeName(ctorFunc interface{}) (string, reflect.Type) { - typeInfo, err := GetTypeInfo(ctorFunc) - if err != nil { - panic(err.Error()) - } - return typeInfo.Name, typeInfo.Type -} - -// getMethodInfo get method info -func getMethodInfo(method reflect.Method, methodValue reflect.Value) MethodInfo { - methodInfo := MethodInfo{} - methodInfo.MethodInfoVal = methodValue - methodInfo.MethodInfoType = methodValue.Type() - methodInfo.Name = method.Name - paramsCount := methodInfo.MethodInfoType.NumIn() - methodInfo.Parameters = make([]ParameterInfo, paramsCount) - - for idx := 0; idx < paramsCount; idx++ { - methodInfo.Parameters[idx].ParameterType = methodInfo.MethodInfoType.In(idx) - methodInfo.Parameters[idx].Name = methodInfo.Parameters[idx].ParameterType.Name() - if methodInfo.MethodInfoType.NumMethod() > 0 { - methodInfo.OutType = methodInfo.MethodInfoType.Out(0) - } - } - - return methodInfo -} - -func GetObjectMethodInfoList(object interface{}) []MethodInfo { - objectType := reflect.TypeOf(object) - objValue := reflect.ValueOf(object) - return GetObjectMethodInfoListWithValueType(objectType, objValue) -} - -func GetObjectMethodInfoListWithValueType(objectType reflect.Type, objValue reflect.Value) []MethodInfo { - methodCount := objValue.NumMethod() - methodInfos := make([]MethodInfo, methodCount) - for idx := 0; idx < methodCount; idx++ { - methodInfo := getMethodInfo(objectType.Method(idx), objValue.Method(idx)) - methodInfos[idx] = methodInfo - } - return methodInfos -} - -func GetObjectMethodInfoByName(object interface{}, methodName string) (MethodInfo, bool) { - objType := reflect.TypeOf(object) - objValue := reflect.ValueOf(object) - return GetObjectMethodInfoByNameWithType(objType, objValue, methodName) -} - -func GetObjectMethodInfoByNameWithType(objectType reflect.Type, objValue reflect.Value, methodName string) (MethodInfo, bool) { - var methodInfo MethodInfo - methodType, rbl := objectType.MethodByName(methodName) - if rbl { - methodInfo = getMethodInfo(methodType, objValue.MethodByName(methodName)) - } - return methodInfo, rbl -} diff --git a/Utils/Reflect/TypeInfo.go b/Utils/Reflect/TypeInfo.go deleted file mode 100644 index 7e9a2a9a..00000000 --- a/Utils/Reflect/TypeInfo.go +++ /dev/null @@ -1,162 +0,0 @@ -package Reflect - -import ( - "errors" - "reflect" -) - -// TypeInfo -type TypeInfo struct { - Name string //TypeInfo Name - ValueType reflect.Value //TypeInfo value - Type reflect.Type //TypeInfo type - Kind reflect.Kind //TypeInfo Kind - IsPtr bool //TypeInfo is Ptr of Kind - CanSet bool //TypeInfo is Ptr and field can set - IsValidation bool //TypeInfo Is valida - fieldInfoListCache map[string]FieldInfo //cache for fieldInfo list - methodInfoListCache map[string]MethodInfo //cache for methodInfo list -} - -// GetTypeInfo: get TypeInfo from instance -func GetTypeInfo(ctorFunc interface{}) (TypeInfo, error) { - ctorVal := reflect.ValueOf(ctorFunc) - return GetTypeInfoWithValueType(ctorVal, ctorVal.Type()) -} - -// GetTypeInfoWithValueType: get TypeInfo by reflect value and type -func GetTypeInfoWithValueType(ctorVal reflect.Value, ctorType reflect.Type) (TypeInfo, error) { - var typeInfo TypeInfo - typeInfo.IsValidation = true - var errorInfo error = nil - typeInfo.Kind = ctorVal.Kind() - if typeInfo.Kind == reflect.Func { - typeInfo.IsValidation = false - if ctorType.NumOut() < 1 { - errorInfo = errors.New("Can not be return out type in ctor func !") - return typeInfo, errorInfo - } - outType := ctorType.Out(0) - typeInfo.Name, typeInfo.Type, typeInfo.IsPtr = getStructOrPtrType(outType) - - } else if typeInfo.Kind == reflect.Struct || typeInfo.Kind == reflect.Ptr { - typeInfo.IsValidation = true - typeInfo.ValueType = ctorVal - typeInfo.Name, typeInfo.Type, typeInfo.IsPtr = getStructOrPtrType(ctorType) - if typeInfo.Kind == reflect.Ptr { - typeInfo.ValueType = typeInfo.ValueType.Elem() - typeInfo.Kind = typeInfo.ValueType.Kind() - } - } else { - errorInfo = errors.New("It's not ctor func or object instance !") - } - - if ctorVal.CanSet() { - typeInfo.CanSet = true - } - if typeInfo.Kind != reflect.Func { - typeInfo.lazyLoadFields() - typeInfo.LazyLoadMethods() - } - return typeInfo, errorInfo -} - -// HasFields the TypeInfo has fields , not empty -func (typeInfo TypeInfo) HasFields() bool { - return len(typeInfo.fieldInfoListCache) > 0 -} - -// HasMethods the TypeInfo has methods , not empty -func (typeInfo TypeInfo) HasMethods() bool { - return len(typeInfo.methodInfoListCache) > 0 -} - -// GetFields: get all fields of TypeInfo -func (typeInfo TypeInfo) GetFields() []FieldInfo { - values := make([]FieldInfo, 0, len(typeInfo.fieldInfoListCache)) - for _, value := range typeInfo.fieldInfoListCache { - values = append(values, value) - } - return nil -} - -// GetFieldByName: get a field of TypeInfo by field name -func (typeInfo TypeInfo) GetFieldByName(fieldName string) FieldInfo { - if typeInfo.HasFields() { - return typeInfo.fieldInfoListCache[fieldName] - } - panic("the TypeInfo is not fields") -} - -// GetMethods: get all methods of TypeInfo -func (typeInfo TypeInfo) GetMethods() []MethodInfo { - values := make([]MethodInfo, 0, len(typeInfo.fieldInfoListCache)) - for _, value := range typeInfo.methodInfoListCache { - values = append(values, value) - } - return nil -} - -// GetMethodByName: get a method of TypeInfo by method name -func (typeInfo TypeInfo) GetMethodByName(methodName string) MethodInfo { - if typeInfo.HasMethods() { - return typeInfo.methodInfoListCache[methodName] - } - panic("the TypeInfo is not methods") -} - -// CreateInstance: create new instance by TypeInfo -func (typeInfo TypeInfo) CreateInstance() interface{} { - return CreateInstance(typeInfo.Type) -} - -// lazyLoadFields: lazy load all fields of TypeInfo -func (typeInfo *TypeInfo) lazyLoadFields() { - if len(typeInfo.fieldInfoListCache) == 0 { - fieldNum := typeInfo.Type.NumField() - typeInfo.fieldInfoListCache = make(map[string]FieldInfo, fieldNum) - - for i := 0; i < fieldNum; i++ { - fieldT := typeInfo.Type.Field(i) - fieldV := typeInfo.ValueType.Field(i) - typeInfo.fieldInfoListCache[fieldT.Name] = FieldInfo{ - Name: fieldT.Name, - Type: fieldT.Type, - Kind: fieldT.Type.Kind(), - Tags: fieldT.Tag, - Value: fieldV, - } - } - } -} - -//LazyLoadMethods: lazy load all methods of TypeInfo -func (typeInfo *TypeInfo) LazyLoadMethods() { - if len(typeInfo.methodInfoListCache) == 0 { - methodList := GetObjectMethodInfoListWithValueType(typeInfo.Type, typeInfo.ValueType) - methodNum := len(methodList) - if methodNum > 0 { - typeInfo.methodInfoListCache = make(map[string]MethodInfo, methodNum) - for i := 0; i < methodNum; i++ { - method := methodList[i] - typeInfo.methodInfoListCache[method.Name] = method - } - } - } -} - -// getStructOrPtrType: get Struct Or Ptr type (name , type , isPtr) -func getStructOrPtrType(outType reflect.Type) (string, reflect.Type, bool) { - var name string - var cType reflect.Type - isPtr := false - if outType.Kind() != reflect.Ptr { - name = outType.Name() - cType = outType - } else { - isPtr = true - name = outType.Elem().Name() - cType = outType.Elem() - } - return name, cType, isPtr -} diff --git a/WebFramework/Mvc/ActionDescriptor.go b/WebFramework/Mvc/ActionDescriptor.go index 6a651c8f..98347c7d 100644 --- a/WebFramework/Mvc/ActionDescriptor.go +++ b/WebFramework/Mvc/ActionDescriptor.go @@ -1,8 +1,8 @@ package Mvc -import "github.com/yoyofx/yoyogo/Utils/Reflect" +import "github.com/yoyofxteam/reflectx" type ActionDescriptor struct { ActionName string - MethodInfo Reflect.MethodInfo + MethodInfo reflectx.MethodInfo } diff --git a/WebFramework/Mvc/ActionExecutorContext.go b/WebFramework/Mvc/ActionExecutorContext.go index ed244c98..00db0e0f 100644 --- a/WebFramework/Mvc/ActionExecutorContext.go +++ b/WebFramework/Mvc/ActionExecutorContext.go @@ -1,19 +1,13 @@ package Mvc import ( - "github.com/yoyofx/yoyogo/Utils/Reflect" "github.com/yoyofx/yoyogo/WebFramework/Context" - "reflect" ) -type ActionExecutorInParam struct { - ActionParamTypes []reflect.Type - MethodInovker *Reflect.MethodCaller -} - type ActionExecutorContext struct { - ControllerName string - ActionName string - Controller IController - Context *Context.HttpContext + ControllerName string + ActionName string + Controller IController + ActionDescriptor ActionDescriptor + Context *Context.HttpContext } diff --git a/WebFramework/Mvc/ActionMethodExecutor.go b/WebFramework/Mvc/ActionMethodExecutor.go index 20c6a135..270b076a 100644 --- a/WebFramework/Mvc/ActionMethodExecutor.go +++ b/WebFramework/Mvc/ActionMethodExecutor.go @@ -2,9 +2,8 @@ package Mvc import ( "errors" - "github.com/yoyofx/yoyogo/Utils/Reflect" "github.com/yoyofx/yoyogo/WebFramework/Context" - "net/http" + "github.com/yoyofxteam/reflectx" "reflect" ) @@ -17,65 +16,37 @@ func NewActionMethodExecutor() ActionMethodExecutor { func (actionExecutor ActionMethodExecutor) Execute(ctx *ActionExecutorContext) interface{} { if ctx.Controller != nil { - methodInfo, methodFounded := Reflect.GetObjectMethodInfoByName(ctx.Controller, ctx.ActionName) - if methodFounded { - values := getParamValues(methodInfo.Parameters, ctx.Context) - returns := methodInfo.InvokeWithValue(values...) - if len(returns) > 0 { - responseData := returns[0] - return responseData - } - } else { - ctx.Context.Response.WriteHeader(http.StatusNotFound) - panic(ctx.ActionName + " action is not found! at " + ctx.ControllerName) + methodInfo := ctx.ActionDescriptor.MethodInfo + values := getParamValues(methodInfo.Parameters, ctx.Context) + returns := methodInfo.InvokeWithValue(reflect.ValueOf(ctx.Controller), values...) + if len(returns) > 0 { + responseData := returns[0] + return responseData } } return nil } -func getParamValues(paramList []Reflect.ParameterInfo, ctx *Context.HttpContext) []reflect.Value { +func getParamValues(paramList []reflectx.MethodParameterInfo, ctx *Context.HttpContext) []reflect.Value { if len(paramList) == 0 { return nil } - values := make([]reflect.Value, len(paramList)) + values := make([]reflect.Value, len(paramList)-1) for index, param := range paramList { + if index == 0 { + continue + } val, err := requestParamTypeConvertFunc(index, param, ctx) if err == nil { - values[index] = val - } - } - - return values -} - -func getParamValues1(paramTypes []reflect.Type, ctx *Context.HttpContext) []interface{} { - if len(paramTypes) == 0 { - return nil - } - values := make([]interface{}, len(paramTypes)) - for index, paramType := range paramTypes { - if paramType.Kind() == reflect.Ptr { - paramType = paramType.Elem() - } - if paramType.Kind() == reflect.Struct { - switch paramType.Name() { - case "HttpContext": - values[index] = ctx - default: - if paramType.NumField() > 0 && paramType.Field(0).Name == "RequestBody" { - reqBindingData := reflect.New(paramType).Interface() - _ = ctx.Bind(reqBindingData) - values[index] = reqBindingData - } - } + values[index-1] = val } } return values } -func requestParamTypeConvertFunc(index int, parameter Reflect.ParameterInfo, ctx *Context.HttpContext) (reflect.Value, error) { +func requestParamTypeConvertFunc(index int, parameter reflectx.MethodParameterInfo, ctx *Context.HttpContext) (reflect.Value, error) { var value reflect.Value var err error = nil paramType := parameter.ParameterType diff --git a/WebFramework/Mvc/ControllerBuilder.go b/WebFramework/Mvc/ControllerBuilder.go index 8ac018c8..2ad36656 100644 --- a/WebFramework/Mvc/ControllerBuilder.go +++ b/WebFramework/Mvc/ControllerBuilder.go @@ -1,7 +1,7 @@ package Mvc import ( - "github.com/yoyofx/yoyogo/Utils/Reflect" + "github.com/yoyofxteam/reflectx" "strings" ) @@ -28,7 +28,7 @@ func (builder *ControllerBuilder) SetupOptions(configOption func(options Options // AddController add controller (ctor) to ioc. func (builder *ControllerBuilder) AddController(controllerCtor interface{}) { - controllerName, controllerType := Reflect.GetCtorFuncOutTypeName(controllerCtor) + controllerName, controllerType := reflectx.GetCtorFuncOutTypeName(controllerCtor) controllerName = strings.ToLower(controllerName) // Create Controller and Action descriptors descriptor := NewControllerDescriptor(controllerName, controllerType, controllerCtor) diff --git a/WebFramework/Mvc/ControllerDescriptor.go b/WebFramework/Mvc/ControllerDescriptor.go index 815c18c9..72d4558a 100644 --- a/WebFramework/Mvc/ControllerDescriptor.go +++ b/WebFramework/Mvc/ControllerDescriptor.go @@ -1,7 +1,7 @@ package Mvc import ( - "github.com/yoyofx/yoyogo/Utils/Reflect" + "github.com/yoyofxteam/reflectx" "reflect" "strings" ) @@ -14,10 +14,10 @@ type ControllerDescriptor struct { } // NewControllerDescriptor create new controller descriptor -func NewControllerDescriptor(name string, cType reflect.Type, controllerCtor interface{}) ControllerDescriptor { +func NewControllerDescriptor(name string, controllerType reflect.Type, controllerCtor interface{}) ControllerDescriptor { - instance := Reflect.CreateInstance(cType) - actionList := Reflect.GetObjectMethodInfoList(instance) + instance := reflect.New(controllerType).Interface() + actionList := reflectx.GetObjectMethodInfoList(instance) actionDescriptors := make(map[string]ActionDescriptor, len(actionList)) diff --git a/WebFramework/Mvc/MvcRouterHandler.go b/WebFramework/Mvc/MvcRouterHandler.go index 89dcd7e3..1042ac53 100644 --- a/WebFramework/Mvc/MvcRouterHandler.go +++ b/WebFramework/Mvc/MvcRouterHandler.go @@ -50,10 +50,11 @@ func (handler *RouterHandler) Invoke(ctx *Context.HttpContext, pathComponents [] actionMethodExecutor := NewActionMethodExecutor() executorContext := &ActionExecutorContext{ - ControllerName: controllerName, - Controller: controller, - ActionName: actionName, - Context: ctx, + ControllerName: controllerName, + Controller: controller, + ActionName: actionName, + ActionDescriptor: actionDescriptor, + Context: ctx, } actionFilterContext := ActionFilterContext{*executorContext, nil} diff --git a/go.mod b/go.mod index 21f41f86..c7a59d0c 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/ugorji/go/codec v1.1.7 github.com/valyala/fasthttp v1.14.0 + github.com/yoyofxteam/reflectx v0.2.3 golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e gopkg.in/yaml.v2 v2.3.0 ) diff --git a/go.sum b/go.sum index 3fbe6050..68f8aed1 100644 --- a/go.sum +++ b/go.sum @@ -20,7 +20,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -30,9 +29,7 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -40,8 +37,6 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/defval/inject/v2 v2.2.1 h1:RsGPgaf/QoOOU289FpqiLqD5knMKD6G2gfXSHYwWvKs= -github.com/defval/inject/v2 v2.2.1/go.mod h1:jYiKxHTLD4fZvHY3r4dKW73IKL9Cn/f0+piDMDPlA6k= github.com/defval/inject/v2 v2.2.2 h1:AK3SFvXRL49xYb12dmHfo/7gl7Mn85iiSaaCuQU4vbA= github.com/defval/inject/v2 v2.2.2/go.mod h1:jYiKxHTLD4fZvHY3r4dKW73IKL9Cn/f0+piDMDPlA6k= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= @@ -90,7 +85,6 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -124,12 +118,8 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.4 h1:jFzIFaf586tquEB5EhzQG0HwGNSlgAJpG53G6Ss11wc= github.com/klauspost/compress v1.10.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -142,8 +132,6 @@ github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/maxzhang1985/yoyogo v1.4.9 h1:zRIE56xUSHBaTrGDhAZqqPIS1hQNUT9qhtL+epbJAwQ= -github.com/maxzhang1985/yoyogo v1.4.9/go.mod h1:aZkej9LRt293K/qa4H4O5qEOD8ZdCZMlnBvuxuGkMzM= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -193,8 +181,6 @@ github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.5.0 h1:GpsTwfsQ27oS/Aha/6d1oD7tpKIqWnOA6tgOX9HHkt4= -github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnTcn4= github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -209,20 +195,18 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.6.0 h1:uWF8lgKmeaIewWVPwi4GRq2P6+R46IgYZdxWtM+GtEY= -github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/fasthttp v1.14.0 h1:67bfuW9azCMwW/Jlq/C+VeihNpAuJMWkYPBig1gdi3A= github.com/valyala/fasthttp v1.14.0/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0zHzaclZhE= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yoyofxteam/reflectx v0.2.3 h1:v/pZFYxW3fA+ZaqG3Kvw4sFPeMYVzLJdjIG2wbeTFJE= +github.com/yoyofxteam/reflectx v0.2.3/go.mod h1:b7rNVLUDcCjk5emUbqMfyF4vj1QT3vyS7e7FNwgnTmA= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -234,7 +218,6 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -265,15 +248,10 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -346,7 +324,6 @@ google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBr google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=