check for pointer to pointer value (#5278)

* check for pointer to pointer value

* revert to Ptr

Co-authored-by: Alexei Melnic <alexei.melnic@meliora.xyz>
This commit is contained in:
aelmel 2022-04-24 04:10:36 +03:00 committed by GitHub
parent 9b80fe9e96
commit 3643f856a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -528,6 +528,9 @@ func (field *Field) setupValuerAndSetter() {
reflectValType := reflectV.Type() reflectValType := reflectV.Type()
if reflectValType.AssignableTo(field.FieldType) { if reflectValType.AssignableTo(field.FieldType) {
if reflectV.Kind() == reflect.Ptr && reflectV.Elem().Kind() == reflect.Ptr {
reflectV = reflect.Indirect(reflectV)
}
field.ReflectValueOf(ctx, value).Set(reflectV) field.ReflectValueOf(ctx, value).Set(reflectV)
return return
} else if reflectValType.ConvertibleTo(field.FieldType) { } else if reflectValType.ConvertibleTo(field.FieldType) {