need to initialize variables scoped to the individual loop, because the address of k,v stay the same and that means we overwrite previous variables when assigning them to the struct directly.

This commit is contained in:
Megan Marsh 2019-10-24 16:15:26 -07:00
parent 5ab31b0363
commit e2283445f2
1 changed files with 4 additions and 2 deletions

View File

@ -8,9 +8,11 @@ import (
func buildEc2Filters(input map[string]string) []*ec2.Filter {
var filters []*ec2.Filter
for k, v := range input {
a := k
b := v
filters = append(filters, &ec2.Filter{
Name: &k,
Values: []*string{&v},
Name: &a,
Values: []*string{&b},
})
}
return filters