Skip to content

Commit 6cc56e7

Browse files
committed
Remove redundant checks
1 parent 3196510 commit 6cc56e7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

vm/runtime/runtime.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,9 @@ type Field struct {
8080

8181
func FetchField(from any, field *Field) any {
8282
v := reflect.ValueOf(from)
83-
kind := v.Kind()
84-
if kind != reflect.Invalid {
85-
if kind == reflect.Ptr {
86-
v = reflect.Indirect(v)
87-
}
83+
if v.Kind() != reflect.Invalid {
84+
v = reflect.Indirect(v)
85+
8886
// We can use v.FieldByIndex here, but it will panic if the field
8987
// is not exists. And we need to recover() to generate a more
9088
// user-friendly error message.

0 commit comments

Comments
 (0)