fix: avoid implicit memory aliasing in for loop
This commit is contained in:
parent
4722553537
commit
561560accb
|
@ -1 +1 @@
|
|||
v5.0.0-beta-2503271956
|
||||
v5.0.0-beta-2503311054
|
||||
|
|
|
@ -63,7 +63,9 @@ func (p *ActionParser) parseJSON(predictionText string) ([]ParsedAction, error)
|
|||
|
||||
// normalize actions
|
||||
var normalizedActions []ParsedAction
|
||||
for _, action := range response.Actions {
|
||||
for i := range response.Actions {
|
||||
// create a new variable, avoid implicit memory aliasing in for loop.
|
||||
action := response.Actions[i]
|
||||
if err := p.normalizeAction(&action); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to normalize action")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue