Skip to content

Commit 9428417

Browse files
authored
Fix reflect.Pointer backward compatibility (#813)
Though we don't officially support older versions of Go, this is an easy fix to unblock people. Fixes #812
1 parent 28f1efc commit 9428417

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

unmarshaler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ func fieldByIndex(v reflect.Value, path []int) reflect.Value {
11401140
for i, x := range path {
11411141
v = v.Field(x)
11421142

1143-
if i < len(path)-1 && v.Kind() == reflect.Pointer {
1143+
if i < len(path)-1 && v.Kind() == reflect.Ptr {
11441144
if v.IsNil() {
11451145
v.Set(reflect.New(v.Type().Elem()))
11461146
}
@@ -1208,7 +1208,7 @@ func forEachField(t reflect.Type, path []int, do func(name string, path []int))
12081208

12091209
if f.Anonymous && name == "" {
12101210
t2 := f.Type
1211-
if t2.Kind() == reflect.Pointer {
1211+
if t2.Kind() == reflect.Ptr {
12121212
t2 = t2.Elem()
12131213
}
12141214

0 commit comments

Comments
 (0)