From 02ebef90316f84689906b2752a7efb63851a9b56 Mon Sep 17 00:00:00 2001 From: James Sinclair Date: Fri, 5 Dec 2014 17:27:00 +1100 Subject: [PATCH] Use an index loop as range loops over copies, not references Fixes #1637 --- builder/amazon/common/block_device.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index dc87c07fb..9557cc579 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -60,12 +60,12 @@ func (b *BlockDevices) Prepare(t *packer.ConfigTemplate) []error { var errs []error for outer, bds := range lists { - for i, bd := range bds { + for i := 0; i < len(bds); i++ { templates := map[string]*string{ - "device_name": &bd.DeviceName, - "snapshot_id": &bd.SnapshotId, - "virtual_name": &bd.VirtualName, - "volume_type": &bd.VolumeType, + "device_name": &bds[i].DeviceName, + "snapshot_id": &bds[i].SnapshotId, + "virtual_name": &bds[i].VirtualName, + "volume_type": &bds[i].VolumeType, } errs := make([]error, 0)