Skip to content

Commit f2ba02b

Browse files
committed
fix: don't cache array/slice length when traversing.
1 parent c028d3c commit f2ba02b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pointers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ func (pv *pointerVisitor) consider(v reflect.Value) {
118118
// Now descend into any children of this value
119119
switch v.Kind() {
120120
case reflect.Slice, reflect.Array:
121-
numEntries := v.Len()
122-
for i := 0; i < numEntries; i++ {
121+
for i := 0; i < v.Len(); i++ {
123122
pv.consider(v.Index(i))
124123
}
125124

0 commit comments

Comments
 (0)