From 8cfa9d98f0ec913fdb1091a4cf3812b25b7fdce4 Mon Sep 17 00:00:00 2001 From: gavwu <68006288+gavwu@users.noreply.github.com> Date: Fri, 2 Apr 2021 09:56:38 +0800 Subject: [PATCH] Update field.go (#4228) seems like the `if-else` branch do the same thing, so remove it --- schema/field.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/schema/field.go b/schema/field.go index 5e792ed1..1881ad1a 100644 --- a/schema/field.go +++ b/schema/field.go @@ -441,15 +441,8 @@ func (field *Field) setupValuerAndSetter() { // ReflectValueOf switch { case len(field.StructField.Index) == 1: - if field.FieldType.Kind() == reflect.Ptr { - field.ReflectValueOf = func(value reflect.Value) reflect.Value { - fieldValue := reflect.Indirect(value).Field(field.StructField.Index[0]) - return fieldValue - } - } else { - field.ReflectValueOf = func(value reflect.Value) reflect.Value { - return reflect.Indirect(value).Field(field.StructField.Index[0]) - } + field.ReflectValueOf = func(value reflect.Value) reflect.Value { + return reflect.Indirect(value).Field(field.StructField.Index[0]) } case len(field.StructField.Index) == 2 && field.StructField.Index[0] >= 0 && field.FieldType.Kind() != reflect.Ptr: field.ReflectValueOf = func(value reflect.Value) reflect.Value {