Skip to content

Commit

Permalink
specify result values array size on make
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob Oaks <jacoboaks.8@gmail.com>
  • Loading branch information
asmeikal and JacobOaks authored Mar 11, 2024
1 parent d026078 commit 16c63d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions result.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ func (ro resultObject) Extract(cw containerWriter, decorated bool, v reflect.Val
}

func (ro resultObject) GetValues(v reflect.Value) []reflect.Value {
res := make([]reflect.Value, 0)
for _, f := range ro.Fields {
res = append(res, v.Field(f.FieldIndex))
res := make([]reflect.Value, len(ro.Fields))
for i, f := range ro.Fields {
res[i] = v.Field(f.FieldIndex)
}
return res
}
Expand Down

0 comments on commit 16c63d6

Please sign in to comment.