Skip to content

Commit

Permalink
fix: don't cache array/slice length when traversing.
Browse files Browse the repository at this point in the history
  • Loading branch information
atombender committed Apr 28, 2022
1 parent c028d3c commit f2ba02b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pointers.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ func (pv *pointerVisitor) consider(v reflect.Value) {
// Now descend into any children of this value
switch v.Kind() {
case reflect.Slice, reflect.Array:
numEntries := v.Len()
for i := 0; i < numEntries; i++ {
for i := 0; i < v.Len(); i++ {
pv.consider(v.Index(i))
}

Expand Down

0 comments on commit f2ba02b

Please sign in to comment.