builder/amazon: AmiFilterOptions.GetOwners: avoid taking the address of a loop iterator var (#8417)

GetOwners() always returned a slice of pointers to the last value. Because slice ranging reuses the same local variable.
This commit is contained in:
Jon Allie 2019-11-27 06:28:07 -05:00 committed by Adrien Delorme
parent 29d6c05ef8
commit c31bbcf4cf
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,8 @@ type AmiFilterOptions struct {
func (d *AmiFilterOptions) GetOwners() []*string {
res := make([]*string, 0, len(d.Owners))
for _, owner := range d.Owners {
res = append(res, &owner)
i := owner
res = append(res, &i)
}
return res
}