Use an index loop as range loops over copies, not references

Fixes #1637
This commit is contained in:
James Sinclair 2014-12-05 17:27:00 +11:00
parent e7f274325e
commit 02ebef9031
1 changed files with 5 additions and 5 deletions

View File

@ -60,12 +60,12 @@ func (b *BlockDevices) Prepare(t *packer.ConfigTemplate) []error {
var errs []error var errs []error
for outer, bds := range lists { for outer, bds := range lists {
for i, bd := range bds { for i := 0; i < len(bds); i++ {
templates := map[string]*string{ templates := map[string]*string{
"device_name": &bd.DeviceName, "device_name": &bds[i].DeviceName,
"snapshot_id": &bd.SnapshotId, "snapshot_id": &bds[i].SnapshotId,
"virtual_name": &bd.VirtualName, "virtual_name": &bds[i].VirtualName,
"volume_type": &bd.VolumeType, "volume_type": &bds[i].VolumeType,
} }
errs := make([]error, 0) errs := make([]error, 0)