improva gconv.Struct
@@ -244,6 +244,7 @@ func bindVarToStructAttr(elem reflect.Value, name string, value interface{}) (er
// bindVarToReflectValue sets <value> to reflect value object <structFieldValue>.
func bindVarToReflectValue(structFieldValue reflect.Value, value interface{}) (err error) {
// Converting using interface.
+ if !structFieldValue.IsNil() {
if v, ok := structFieldValue.Interface().(apiSet); ok {
v.Set(value)
return nil
@@ -253,6 +254,8 @@ func bindVarToReflectValue(structFieldValue reflect.Value, value interface{}) (e
return err
}
}
+ }
+
// Converting by kind.
switch structFieldValue.Kind() {
case reflect.Struct:
