Skip to content

Commit bbd3c82

Browse files
author
David A. Eilertsen
committed
shorten
1 parent 0d95e38 commit bbd3c82

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

placeholder.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,16 @@ func isEmpty(i interface{}) bool {
7070
}
7171

7272
val := reflect.ValueOf(i)
73-
7473
switch val.Kind() {
7574
case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
7675
return val.Len() == 0
7776
case reflect.Ptr:
7877
if val.IsNil() {
7978
return true
8079
}
81-
deref := val.Elem().Interface()
82-
return isEmpty(deref)
80+
81+
return isEmpty(val.Elem().Interface())
8382
default:
84-
zero := reflect.Zero(val.Type())
85-
return reflect.DeepEqual(i, zero.Interface())
83+
return reflect.DeepEqual(i, reflect.Zero(val.Type()).Interface())
8684
}
8785
}

0 commit comments

Comments
 (0)