From d920b3fbf424e1c1da98682b9868b76d61467eea Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Tue, 1 Nov 2016 14:08:04 -0700 Subject: [PATCH] run gofmt --- builder/amazon/chroot/builder.go | 10 ++-- builder/amazon/chroot/builder_test.go | 2 +- builder/amazon/common/step_deregister_ami.go | 2 +- builder/amazon/common/step_pre_validate.go | 2 +- .../amazon/common/step_run_source_instance.go | 4 +- builder/amazon/ebs/builder_acc_test.go | 2 +- builder/amazon/ebs/step_cleanup_volumes.go | 6 +- builder/digitalocean/step_create_droplet.go | 2 +- builder/googlecompute/driver_gce.go | 6 +- .../parallels/common/prlctl_config_test.go | 2 +- .../common/prlctl_post_config_test.go | 2 +- .../common/step_type_boot_command_test.go | 20 +++---- builder/profitbricks/builder_test.go | 10 ++-- builder/profitbricks/step_create_server.go | 8 +-- builder/profitbricks/step_take_snapshot.go | 4 +- builder/qemu/builder.go | 8 +-- builder/qemu/builder_test.go | 4 +- .../common/vboxmanage_config_test.go | 2 +- .../common/vboxmanage_post_config_test.go | 2 +- builder/vmware/common/step_clean_vmx.go | 2 +- builder/vmware/common/step_configure_vmx.go | 2 +- builder/vmware/common/vmx.go | 2 +- builder/vmware/iso/step_create_vmx.go | 2 +- command/inspect.go | 4 +- command/push_test.go | 6 +- common/download.go | 2 +- common/step_create_floppy.go | 2 +- common/step_create_floppy_test.go | 52 ++++++++--------- communicator/ssh/communicator.go | 4 +- communicator/ssh/password.go | 2 +- fix/fixer_createtime_test.go | 2 +- fix/fixer_iso_md5_test.go | 2 +- packer/build_test.go | 36 ++++++------ packer/core.go | 2 +- packer/hook_test.go | 2 +- packer/plugin/client.go | 2 +- provisioner/chef-client/provisioner.go | 4 +- provisioner/chef-solo/provisioner.go | 4 +- provisioner/guest_commands.go | 4 +- template/interpolate/parse_test.go | 2 +- template/parse_test.go | 56 +++++++++---------- template/template.go | 2 +- 42 files changed, 148 insertions(+), 148 deletions(-) diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index d2a9fbfa1..45f74a69a 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -86,11 +86,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { if len(b.config.ChrootMounts) == 0 { b.config.ChrootMounts = [][]string{ - []string{"proc", "proc", "/proc"}, - []string{"sysfs", "sysfs", "/sys"}, - []string{"bind", "/dev", "/dev"}, - []string{"devpts", "devpts", "/dev/pts"}, - []string{"binfmt_misc", "binfmt_misc", "/proc/sys/fs/binfmt_misc"}, + {"proc", "proc", "/proc"}, + {"sysfs", "sysfs", "/sys"}, + {"bind", "/dev", "/dev"}, + {"devpts", "devpts", "/dev/pts"}, + {"binfmt_misc", "binfmt_misc", "/proc/sys/fs/binfmt_misc"}, } } diff --git a/builder/amazon/chroot/builder_test.go b/builder/amazon/chroot/builder_test.go index 291651477..dccbef39b 100644 --- a/builder/amazon/chroot/builder_test.go +++ b/builder/amazon/chroot/builder_test.go @@ -71,7 +71,7 @@ func TestBuilderPrepare_ChrootMounts(t *testing.T) { } config["chroot_mounts"] = [][]string{ - []string{"bad"}, + {"bad"}, } warnings, err = b.Prepare(config) if len(warnings) > 0 { diff --git a/builder/amazon/common/step_deregister_ami.go b/builder/amazon/common/step_deregister_ami.go index 1ea4325cd..f92de2797 100644 --- a/builder/amazon/common/step_deregister_ami.go +++ b/builder/amazon/common/step_deregister_ami.go @@ -21,7 +21,7 @@ func (s *StepDeregisterAMI) Run(state multistep.StateBag) multistep.StepAction { // check for force deregister if s.ForceDeregister { resp, err := ec2conn.DescribeImages(&ec2.DescribeImagesInput{ - Filters: []*ec2.Filter{&ec2.Filter{ + Filters: []*ec2.Filter{{ Name: aws.String("name"), Values: []*string{aws.String(s.AMIName)}, }}}) diff --git a/builder/amazon/common/step_pre_validate.go b/builder/amazon/common/step_pre_validate.go index 86bb8e23d..9ba97264f 100644 --- a/builder/amazon/common/step_pre_validate.go +++ b/builder/amazon/common/step_pre_validate.go @@ -28,7 +28,7 @@ func (s *StepPreValidate) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Prevalidating AMI Name...") resp, err := ec2conn.DescribeImages(&ec2.DescribeImagesInput{ - Filters: []*ec2.Filter{&ec2.Filter{ + Filters: []*ec2.Filter{{ Name: aws.String("name"), Values: []*string{aws.String(s.DestAmiName)}, }}}) diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index 6ebc2933a..fbac16e77 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -171,7 +171,7 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi if s.SubnetId != "" && s.AssociatePublicIpAddress { runOpts.NetworkInterfaces = []*ec2.InstanceNetworkInterfaceSpecification{ - &ec2.InstanceNetworkInterfaceSpecification{ + { DeviceIndex: aws.Int64(0), AssociatePublicIpAddress: &s.AssociatePublicIpAddress, SubnetId: &s.SubnetId, @@ -207,7 +207,7 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi UserData: &userData, IamInstanceProfile: &ec2.IamInstanceProfileSpecification{Name: &s.IamInstanceProfile}, NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ - &ec2.InstanceNetworkInterfaceSpecification{ + { DeviceIndex: aws.Int64(0), AssociatePublicIpAddress: &s.AssociatePublicIpAddress, SubnetId: &s.SubnetId, diff --git a/builder/amazon/ebs/builder_acc_test.go b/builder/amazon/ebs/builder_acc_test.go index b77e5853b..44a1a5185 100644 --- a/builder/amazon/ebs/builder_acc_test.go +++ b/builder/amazon/ebs/builder_acc_test.go @@ -138,7 +138,7 @@ func checkRegionCopy(regions []string) builderT.TestCheckFunc { for _, r := range regions { regionSet[r] = struct{}{} } - for r, _ := range artifact.Amis { + for r := range artifact.Amis { if _, ok := regionSet[r]; !ok { return fmt.Errorf("unknown region: %s", r) } diff --git a/builder/amazon/ebs/step_cleanup_volumes.go b/builder/amazon/ebs/step_cleanup_volumes.go index e9d33fa32..901e20d83 100644 --- a/builder/amazon/ebs/step_cleanup_volumes.go +++ b/builder/amazon/ebs/step_cleanup_volumes.go @@ -66,7 +66,7 @@ func (s *stepCleanupVolumes) Cleanup(state multistep.StateBag) { // date information on them resp, err := ec2conn.DescribeVolumes(&ec2.DescribeVolumesInput{ Filters: []*ec2.Filter{ - &ec2.Filter{ + { Name: aws.String("volume-id"), Values: vl, }, @@ -92,7 +92,7 @@ func (s *stepCleanupVolumes) Cleanup(state multistep.StateBag) { } // Filter out any devices marked for saving - for saveName, _ := range save { + for saveName := range save { for volKey, volName := range volList { if volName == saveName { delete(volList, volKey) @@ -101,7 +101,7 @@ func (s *stepCleanupVolumes) Cleanup(state multistep.StateBag) { } // Destroy remaining volumes - for k, _ := range volList { + for k := range volList { ui.Say(fmt.Sprintf("Destroying volume (%s)...", k)) _, err := ec2conn.DeleteVolume(&ec2.DeleteVolumeInput{VolumeId: aws.String(k)}) if err != nil { diff --git a/builder/digitalocean/step_create_droplet.go b/builder/digitalocean/step_create_droplet.go index 45d6db9da..acd9fd771 100644 --- a/builder/digitalocean/step_create_droplet.go +++ b/builder/digitalocean/step_create_droplet.go @@ -41,7 +41,7 @@ func (s *stepCreateDroplet) Run(state multistep.StateBag) multistep.StepAction { Slug: c.Image, }, SSHKeys: []godo.DropletCreateSSHKey{ - godo.DropletCreateSSHKey{ID: int(sshKeyId)}, + {ID: int(sshKeyId)}, }, PrivateNetworking: c.PrivateNetworking, UserData: userData, diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index 3d524d152..105a3578c 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -347,7 +347,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { instance := compute.Instance{ Description: c.Description, Disks: []*compute.AttachedDisk{ - &compute.AttachedDisk{ + { Type: "PERSISTENT", Mode: "READ_WRITE", Kind: "compute#attachedDisk", @@ -366,7 +366,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { }, Name: c.Name, NetworkInterfaces: []*compute.NetworkInterface{ - &compute.NetworkInterface{ + { AccessConfigs: []*compute.AccessConfig{accessconfig}, Network: network.SelfLink, Subnetwork: subnetworkSelfLink, @@ -376,7 +376,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { Preemptible: c.Preemptible, }, ServiceAccounts: []*compute.ServiceAccount{ - &compute.ServiceAccount{ + { Email: c.ServiceAccountEmail, Scopes: c.Scopes, }, diff --git a/builder/parallels/common/prlctl_config_test.go b/builder/parallels/common/prlctl_config_test.go index cafb3d23c..8e1e50185 100644 --- a/builder/parallels/common/prlctl_config_test.go +++ b/builder/parallels/common/prlctl_config_test.go @@ -28,7 +28,7 @@ func TestPrlctlConfigPrepare_Prlctl(t *testing.T) { } expected := [][]string{ - []string{"foo", "bar", "baz"}, + {"foo", "bar", "baz"}, } if !reflect.DeepEqual(c.Prlctl, expected) { diff --git a/builder/parallels/common/prlctl_post_config_test.go b/builder/parallels/common/prlctl_post_config_test.go index c091a1a92..61540f0d4 100644 --- a/builder/parallels/common/prlctl_post_config_test.go +++ b/builder/parallels/common/prlctl_post_config_test.go @@ -28,7 +28,7 @@ func TestPrlctlPostConfigPrepare_PrlctlPost(t *testing.T) { } expected := [][]string{ - []string{"foo", "bar", "baz"}, + {"foo", "bar", "baz"}, } if !reflect.DeepEqual(c.PrlctlPost, expected) { diff --git a/builder/parallels/common/step_type_boot_command_test.go b/builder/parallels/common/step_type_boot_command_test.go index 2570e7fbe..275bbb0dc 100644 --- a/builder/parallels/common/step_type_boot_command_test.go +++ b/builder/parallels/common/step_type_boot_command_test.go @@ -46,16 +46,16 @@ func TestStepTypeBootCommand(t *testing.T) { // Verify var expected = [][]string{ - []string{"02", "82", "03", "83", "04", "84", "05", "85", "06", "86", "07", "87", "08", "88", "09", "89", "0a", "8a", "0b", "8b", "0c", "8c", "0d", "8d", "1c", "9c"}, - []string{}, - []string{"2a", "02", "82", "aa", "2a", "03", "83", "aa", "2a", "04", "84", "aa", "2a", "05", "85", "aa", "2a", "06", "86", "aa", "2a", "07", "87", "aa", "2a", "08", "88", "aa", "2a", "09", "89", "aa", "2a", "0a", "8a", "aa", "2a", "0b", "8b", "aa", "2a", "0c", "8c", "aa", "2a", "0d", "8d", "aa", "1c", "9c"}, - []string{"10", "90", "11", "91", "12", "92", "13", "93", "14", "94", "15", "95", "16", "96", "17", "97", "18", "98", "19", "99", "1a", "9a", "1b", "9b", "1c", "9c"}, - []string{"2a", "10", "90", "aa", "2a", "11", "91", "aa", "2a", "12", "92", "aa", "2a", "13", "93", "aa", "2a", "14", "94", "aa", "2a", "15", "95", "aa", "2a", "16", "96", "aa", "2a", "17", "97", "aa", "2a", "18", "98", "aa", "2a", "19", "99", "aa", "2a", "1a", "9a", "aa", "2a", "1b", "9b", "aa", "1c", "9c"}, - []string{"1e", "9e", "1f", "9f", "20", "a0", "21", "a1", "22", "a2", "23", "a3", "24", "a4", "25", "a5", "26", "a6", "27", "a7", "28", "a8", "29", "a9", "1c", "9c"}, - []string{"2a", "1e", "9e", "aa", "2a", "1f", "9f", "aa", "2a", "20", "a0", "aa", "2a", "21", "a1", "aa", "2a", "22", "a2", "aa", "2a", "23", "a3", "aa", "2a", "24", "a4", "aa", "2a", "25", "a5", "aa", "2a", "26", "a6", "aa", "2a", "27", "a7", "aa", "2a", "28", "a8", "aa", "2a", "29", "a9", "aa", "1c", "9c"}, - []string{"2b", "ab", "2c", "ac", "2d", "ad", "2e", "ae", "2f", "af", "30", "b0", "31", "b1", "32", "b2", "33", "b3", "34", "b4", "35", "b5", "1c", "9c"}, - []string{"2a", "2b", "ab", "aa", "2a", "2c", "ac", "aa", "2a", "2d", "ad", "aa", "2a", "2e", "ae", "aa", "2a", "2f", "af", "aa", "2a", "30", "b0", "aa", "2a", "31", "b1", "aa", "2a", "32", "b2", "aa", "2a", "33", "b3", "aa", "2a", "34", "b4", "aa", "2a", "35", "b5", "aa", "1c", "9c"}, - []string{"39", "b9", "1c", "9c"}, + {"02", "82", "03", "83", "04", "84", "05", "85", "06", "86", "07", "87", "08", "88", "09", "89", "0a", "8a", "0b", "8b", "0c", "8c", "0d", "8d", "1c", "9c"}, + {}, + {"2a", "02", "82", "aa", "2a", "03", "83", "aa", "2a", "04", "84", "aa", "2a", "05", "85", "aa", "2a", "06", "86", "aa", "2a", "07", "87", "aa", "2a", "08", "88", "aa", "2a", "09", "89", "aa", "2a", "0a", "8a", "aa", "2a", "0b", "8b", "aa", "2a", "0c", "8c", "aa", "2a", "0d", "8d", "aa", "1c", "9c"}, + {"10", "90", "11", "91", "12", "92", "13", "93", "14", "94", "15", "95", "16", "96", "17", "97", "18", "98", "19", "99", "1a", "9a", "1b", "9b", "1c", "9c"}, + {"2a", "10", "90", "aa", "2a", "11", "91", "aa", "2a", "12", "92", "aa", "2a", "13", "93", "aa", "2a", "14", "94", "aa", "2a", "15", "95", "aa", "2a", "16", "96", "aa", "2a", "17", "97", "aa", "2a", "18", "98", "aa", "2a", "19", "99", "aa", "2a", "1a", "9a", "aa", "2a", "1b", "9b", "aa", "1c", "9c"}, + {"1e", "9e", "1f", "9f", "20", "a0", "21", "a1", "22", "a2", "23", "a3", "24", "a4", "25", "a5", "26", "a6", "27", "a7", "28", "a8", "29", "a9", "1c", "9c"}, + {"2a", "1e", "9e", "aa", "2a", "1f", "9f", "aa", "2a", "20", "a0", "aa", "2a", "21", "a1", "aa", "2a", "22", "a2", "aa", "2a", "23", "a3", "aa", "2a", "24", "a4", "aa", "2a", "25", "a5", "aa", "2a", "26", "a6", "aa", "2a", "27", "a7", "aa", "2a", "28", "a8", "aa", "2a", "29", "a9", "aa", "1c", "9c"}, + {"2b", "ab", "2c", "ac", "2d", "ad", "2e", "ae", "2f", "af", "30", "b0", "31", "b1", "32", "b2", "33", "b3", "34", "b4", "35", "b5", "1c", "9c"}, + {"2a", "2b", "ab", "aa", "2a", "2c", "ac", "aa", "2a", "2d", "ad", "aa", "2a", "2e", "ae", "aa", "2a", "2f", "af", "aa", "2a", "30", "b0", "aa", "2a", "31", "b1", "aa", "2a", "32", "b2", "aa", "2a", "33", "b3", "aa", "2a", "34", "b4", "aa", "2a", "35", "b5", "aa", "1c", "9c"}, + {"39", "b9", "1c", "9c"}, } fail := false diff --git a/builder/profitbricks/builder_test.go b/builder/profitbricks/builder_test.go index b1f74ff2a..65e284690 100644 --- a/builder/profitbricks/builder_test.go +++ b/builder/profitbricks/builder_test.go @@ -8,11 +8,11 @@ import ( func testConfig() map[string]interface{} { return map[string]interface{}{ - "image": "Ubuntu-16.04", - "password": "password", - "username": "username", + "image": "Ubuntu-16.04", + "password": "password", + "username": "username", "snapshot_name": "packer", - "type": "profitbricks", + "type": "profitbricks", } } @@ -53,4 +53,4 @@ func TestBuilderPrepare_InvalidKey(t *testing.T) { if err == nil { t.Fatal("should have error") } -} \ No newline at end of file +} diff --git a/builder/profitbricks/step_create_server.go b/builder/profitbricks/step_create_server.go index 2e83fd6c8..fa57ad1b2 100644 --- a/builder/profitbricks/step_create_server.go +++ b/builder/profitbricks/step_create_server.go @@ -66,7 +66,7 @@ func (s *stepCreateServer) Run(state multistep.StateBag) multistep.StepAction { if datacenter.StatusCode > 299 { var restError RestError json.Unmarshal([]byte(datacenter.Response), &restError) - if ( len(restError.Messages) > 0) { + if len(restError.Messages) > 0 { ui.Error(restError.Messages[0].Message) } else { ui.Error(datacenter.Response) @@ -169,13 +169,13 @@ func (d *stepCreateServer) checkForErrors(instance profitbricks.Resp) error { } type RestError struct { - HttpStatus int `json:"httpStatus,omitempty"` - Messages []Message`json:"messages,omitempty"` + HttpStatus int `json:"httpStatus,omitempty"` + Messages []Message `json:"messages,omitempty"` } type Message struct { ErrorCode string `json:"errorCode,omitempty"` - Message string`json:"message,omitempty"` + Message string `json:"message,omitempty"` } func (d *stepCreateServer) getImageId(imageName string, c *Config) string { diff --git a/builder/profitbricks/step_take_snapshot.go b/builder/profitbricks/step_take_snapshot.go index a3280e048..e4133df92 100644 --- a/builder/profitbricks/step_take_snapshot.go +++ b/builder/profitbricks/step_take_snapshot.go @@ -1,13 +1,13 @@ package profitbricks import ( + "encoding/json" "errors" "fmt" "github.com/mitchellh/multistep" "github.com/mitchellh/packer/packer" "github.com/profitbricks/profitbricks-sdk-go" "time" - "encoding/json" ) type stepTakeSnapshot struct{} @@ -30,7 +30,7 @@ func (s *stepTakeSnapshot) Run(state multistep.StateBag) multistep.StepAction { if snapshot.StatusCode > 299 { var restError RestError json.Unmarshal([]byte(snapshot.Response), &restError) - if ( len(restError.Messages) > 0) { + if len(restError.Messages) > 0 { ui.Error(restError.Messages[0].Message) } else { ui.Error(snapshot.Response) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 6fc5477f5..26cdd90eb 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -21,10 +21,10 @@ import ( const BuilderId = "transcend.qemu" var accels = map[string]struct{}{ - "none": struct{}{}, - "kvm": struct{}{}, - "tcg": struct{}{}, - "xen": struct{}{}, + "none": {}, + "kvm": {}, + "tcg": {}, + "xen": {}, } var netDevice = map[string]bool{ diff --git a/builder/qemu/builder_test.go b/builder/qemu/builder_test.go index 1f28bbac6..5d9d4edf7 100644 --- a/builder/qemu/builder_test.go +++ b/builder/qemu/builder_test.go @@ -570,7 +570,7 @@ func TestBuilderPrepare_QemuArgs(t *testing.T) { // Test with a good one config["qemuargs"] = [][]interface{}{ - []interface{}{"foo", "bar", "baz"}, + {"foo", "bar", "baz"}, } b = Builder{} @@ -583,7 +583,7 @@ func TestBuilderPrepare_QemuArgs(t *testing.T) { } expected := [][]string{ - []string{"foo", "bar", "baz"}, + {"foo", "bar", "baz"}, } if !reflect.DeepEqual(b.config.QemuArgs, expected) { diff --git a/builder/virtualbox/common/vboxmanage_config_test.go b/builder/virtualbox/common/vboxmanage_config_test.go index d089b977a..fec2a9094 100644 --- a/builder/virtualbox/common/vboxmanage_config_test.go +++ b/builder/virtualbox/common/vboxmanage_config_test.go @@ -28,7 +28,7 @@ func TestVBoxManageConfigPrepare_VBoxManage(t *testing.T) { } expected := [][]string{ - []string{"foo", "bar", "baz"}, + {"foo", "bar", "baz"}, } if !reflect.DeepEqual(c.VBoxManage, expected) { diff --git a/builder/virtualbox/common/vboxmanage_post_config_test.go b/builder/virtualbox/common/vboxmanage_post_config_test.go index 60a2c7abb..a3c4dffe8 100644 --- a/builder/virtualbox/common/vboxmanage_post_config_test.go +++ b/builder/virtualbox/common/vboxmanage_post_config_test.go @@ -28,7 +28,7 @@ func TestVBoxManagePostConfigPrepare_VBoxManage(t *testing.T) { } expected := [][]string{ - []string{"foo", "bar", "baz"}, + {"foo", "bar", "baz"}, } if !reflect.DeepEqual(c.VBoxManagePost, expected) { diff --git a/builder/vmware/common/step_clean_vmx.go b/builder/vmware/common/step_clean_vmx.go index eb67aa14d..42870f48e 100755 --- a/builder/vmware/common/step_clean_vmx.go +++ b/builder/vmware/common/step_clean_vmx.go @@ -35,7 +35,7 @@ func (s StepCleanVMX) Run(state multistep.StateBag) multistep.StepAction { // Delete the floppy0 entries so the floppy is no longer mounted ui.Message("Unmounting floppy from VMX...") - for k, _ := range vmxData { + for k := range vmxData { if strings.HasPrefix(k, "floppy0.") { log.Printf("Deleting key: %s", k) delete(vmxData, k) diff --git a/builder/vmware/common/step_configure_vmx.go b/builder/vmware/common/step_configure_vmx.go index 401d53055..7c8ca7717 100755 --- a/builder/vmware/common/step_configure_vmx.go +++ b/builder/vmware/common/step_configure_vmx.go @@ -44,7 +44,7 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction { // Delete any generated addresses since we want to regenerate // them. Conflicting MAC addresses is a bad time. addrRegex := regexp.MustCompile(`(?i)^ethernet\d+\.generatedAddress`) - for k, _ := range vmxData { + for k := range vmxData { if addrRegex.MatchString(k) { delete(vmxData, k) } diff --git a/builder/vmware/common/vmx.go b/builder/vmware/common/vmx.go index 1735bfb53..1fcdfa35e 100755 --- a/builder/vmware/common/vmx.go +++ b/builder/vmware/common/vmx.go @@ -38,7 +38,7 @@ func EncodeVMX(contents map[string]string) string { i := 0 keys := make([]string, len(contents)) - for k, _ := range contents { + for k := range contents { keys[i] = k i++ } diff --git a/builder/vmware/iso/step_create_vmx.go b/builder/vmware/iso/step_create_vmx.go index 272721893..23281cd01 100755 --- a/builder/vmware/iso/step_create_vmx.go +++ b/builder/vmware/iso/step_create_vmx.go @@ -70,7 +70,7 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction { ctx := config.ctx if len(config.AdditionalDiskSize) > 0 { - for i, _ := range config.AdditionalDiskSize { + for i := range config.AdditionalDiskSize { ctx.Data = &additionalDiskTemplateData{ DiskNumber: i + 1, DiskName: config.DiskName, diff --git a/command/inspect.go b/command/inspect.go index f564b2689..49302b023 100644 --- a/command/inspect.go +++ b/command/inspect.go @@ -66,7 +66,7 @@ func (c *InspectCommand) Run(args []string) int { ui.Say("Optional variables and their defaults:\n") keys := make([]string, 0, len(tpl.Variables)) max := 0 - for k, _ := range tpl.Variables { + for k := range tpl.Variables { keys = append(keys, k) if len(k) > max { max = len(k) @@ -98,7 +98,7 @@ func (c *InspectCommand) Run(args []string) int { } else { keys := make([]string, 0, len(tpl.Builders)) max := 0 - for k, _ := range tpl.Builders { + for k := range tpl.Builders { keys = append(keys, k) if len(k) > max { max = len(k) diff --git a/command/push_test.go b/command/push_test.go index 9d7b79be7..2a37381f2 100644 --- a/command/push_test.go +++ b/command/push_test.go @@ -60,7 +60,7 @@ func TestPush(t *testing.T) { } expectedBuilds := map[string]*uploadBuildInfo{ - "dummy": &uploadBuildInfo{ + "dummy": { Type: "dummy", }, } @@ -91,11 +91,11 @@ func TestPush_builds(t *testing.T) { } expectedBuilds := map[string]*uploadBuildInfo{ - "dummy": &uploadBuildInfo{ + "dummy": { Type: "dummy", Artifact: true, }, - "foo": &uploadBuildInfo{ + "foo": { Type: "dummy", }, } diff --git a/common/download.go b/common/download.go index 5bcf7de76..e4d9d4048 100644 --- a/common/download.go +++ b/common/download.go @@ -132,7 +132,7 @@ func (d *DownloadClient) Get() (string, error) { // Remove forward slash on absolute Windows file URLs before processing if runtime.GOOS == "windows" && len(finalPath) > 0 && finalPath[0] == '/' { - finalPath = finalPath[1:len(finalPath)] + finalPath = finalPath[1:] } // Keep track of the source so we can make sure not to delete this later sourcePath = finalPath diff --git a/common/step_create_floppy.go b/common/step_create_floppy.go index 6bccc9fc4..9b5e7d812 100644 --- a/common/step_create_floppy.go +++ b/common/step_create_floppy.go @@ -353,7 +353,7 @@ func fsDirectoryCache(rootDirectory fs.Directory) directoryCache { // directory not cached, so start at the root and walk each component // creating them if they're not in cache var entry fs.Directory - for i, _ := range component { + for i := range component { // join all of our components into a key path := strings.Join(component[:i], "/") diff --git a/common/step_create_floppy_test.go b/common/step_create_floppy_test.go index a5a3e9fd9..fcac9a891 100644 --- a/common/step_create_floppy_test.go +++ b/common/step_create_floppy_test.go @@ -76,12 +76,12 @@ func TestStepCreateFloppy(t *testing.T) { lists := [][]string{ files, - []string{dir + string(os.PathSeparator) + prefix + "*" + ext}, - []string{dir + string(os.PathSeparator) + prefix + "?" + ext}, - []string{dir + string(os.PathSeparator) + prefix + "[0123456789]" + ext}, - []string{dir + string(os.PathSeparator) + prefix + "[0-9]" + ext}, - []string{dir + string(os.PathSeparator)}, - []string{dir}, + {dir + string(os.PathSeparator) + prefix + "*" + ext}, + {dir + string(os.PathSeparator) + prefix + "?" + ext}, + {dir + string(os.PathSeparator) + prefix + "[0123456789]" + ext}, + {dir + string(os.PathSeparator) + prefix + "[0-9]" + ext}, + {dir + string(os.PathSeparator)}, + {dir}, } for _, step.Files = range lists { @@ -177,12 +177,12 @@ func xxxTestStepCreateFloppy_notfound(t *testing.T) { } lists := [][]string{ - []string{dir + string(os.PathSeparator) + prefix + "*"}, - []string{dir + string(os.PathSeparator) + prefix + "?"}, - []string{dir + string(os.PathSeparator) + prefix + "[0123456789]"}, - []string{dir + string(os.PathSeparator) + prefix + "[0-9]"}, - []string{dir + string(os.PathSeparator)}, - []string{dir}, + {dir + string(os.PathSeparator) + prefix + "*"}, + {dir + string(os.PathSeparator) + prefix + "?"}, + {dir + string(os.PathSeparator) + prefix + "[0123456789]"}, + {dir + string(os.PathSeparator) + prefix + "[0-9]"}, + {dir + string(os.PathSeparator)}, + {dir}, } for _, step.Files = range lists { @@ -225,22 +225,22 @@ func TestStepCreateFloppyDirectories(t *testing.T) { // keep in mind that .FilesAdded doesn't keep track of the target filename or directories, but rather the source filename. directories := [][]contentsTest{ - []contentsTest{ - contentsTest{dirs: []string{"file1", "file2", "file3"}, result: []string{"file1", "file2", "file3"}}, - contentsTest{dirs: []string{"file?"}, result: []string{"file1", "file2", "file3"}}, - contentsTest{dirs: []string{"*"}, result: []string{"file1", "file2", "file3"}}, + { + {dirs: []string{"file1", "file2", "file3"}, result: []string{"file1", "file2", "file3"}}, + {dirs: []string{"file?"}, result: []string{"file1", "file2", "file3"}}, + {dirs: []string{"*"}, result: []string{"file1", "file2", "file3"}}, }, - []contentsTest{ - contentsTest{dirs: []string{"dir1"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, - contentsTest{dirs: []string{"dir1/file1", "dir1/file2", "dir1/file3"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, - contentsTest{dirs: []string{"*"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, - contentsTest{dirs: []string{"*/*"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, + { + {dirs: []string{"dir1"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, + {dirs: []string{"dir1/file1", "dir1/file2", "dir1/file3"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, + {dirs: []string{"*"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, + {dirs: []string{"*/*"}, result: []string{"dir1/file1", "dir1/file2", "dir1/file3"}}, }, - []contentsTest{ - contentsTest{dirs: []string{"dir1"}, result: []string{"dir1/file1", "dir1/subdir1/file1", "dir1/subdir1/file2"}}, - contentsTest{dirs: []string{"dir2/*"}, result: []string{"dir2/subdir1/file1", "dir2/subdir1/file2"}}, - contentsTest{dirs: []string{"dir2/subdir1"}, result: []string{"dir2/subdir1/file1", "dir2/subdir1/file2"}}, - contentsTest{dirs: []string{"dir?"}, result: []string{"dir1/file1", "dir1/subdir1/file1", "dir1/subdir1/file2", "dir2/subdir1/file1", "dir2/subdir1/file2"}}, + { + {dirs: []string{"dir1"}, result: []string{"dir1/file1", "dir1/subdir1/file1", "dir1/subdir1/file2"}}, + {dirs: []string{"dir2/*"}, result: []string{"dir2/subdir1/file1", "dir2/subdir1/file2"}}, + {dirs: []string{"dir2/subdir1"}, result: []string{"dir2/subdir1/file1", "dir2/subdir1/file2"}}, + {dirs: []string{"dir?"}, result: []string{"dir1/file1", "dir1/subdir1/file1", "dir1/subdir1/file2", "dir2/subdir1/file1", "dir2/subdir1/file2"}}, }, } diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index aadc69058..cceeeb5eb 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -164,7 +164,7 @@ func (c *comm) DownloadDir(src string, dst string, excl []string) error { switch fi[0] { case '\x01', '\x02': - return fmt.Errorf("%s", fi[1:len(fi)]) + return fmt.Errorf("%s", fi[1:]) case 'C', 'D': break case 'E': @@ -593,7 +593,7 @@ func (c *comm) scpDownloadSession(path string, output io.Writer) error { switch fi[0] { case '\x01', '\x02': - return fmt.Errorf("%s", fi[1:len(fi)]) + return fmt.Errorf("%s", fi[1:]) case 'C': case 'D': return fmt.Errorf("remote file is directory") diff --git a/communicator/ssh/password.go b/communicator/ssh/password.go index c406975ab..8db6f82da 100644 --- a/communicator/ssh/password.go +++ b/communicator/ssh/password.go @@ -18,7 +18,7 @@ func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallen // Just send the password back for all questions answers := make([]string, len(questions)) - for i, _ := range answers { + for i := range answers { answers[i] = string(password) } diff --git a/fix/fixer_createtime_test.go b/fix/fixer_createtime_test.go index 23736aa0f..ae91c6c22 100644 --- a/fix/fixer_createtime_test.go +++ b/fix/fixer_createtime_test.go @@ -27,7 +27,7 @@ func TestFixerCreateTime_Fix(t *testing.T) { expected := map[string]interface{}{ "builders": []map[string]interface{}{ - map[string]interface{}{ + { "type": "foo", "ami_name": "{{timestamp}} foo", }, diff --git a/fix/fixer_iso_md5_test.go b/fix/fixer_iso_md5_test.go index 09be5e0e1..0c0e989b5 100644 --- a/fix/fixer_iso_md5_test.go +++ b/fix/fixer_iso_md5_test.go @@ -27,7 +27,7 @@ func TestFixerISOMD5_Fix(t *testing.T) { expected := map[string]interface{}{ "builders": []map[string]interface{}{ - map[string]interface{}{ + { "type": "foo", "iso_checksum": "bar", "iso_checksum_type": "md5", diff --git a/packer/build_test.go b/packer/build_test.go index 804ecbaf4..af5b62ebd 100644 --- a/packer/build_test.go +++ b/packer/build_test.go @@ -12,14 +12,14 @@ func testBuild() *coreBuild { builderConfig: 42, builderType: "foo", hooks: map[string][]Hook{ - "foo": []Hook{&MockHook{}}, + "foo": {&MockHook{}}, }, provisioners: []coreBuildProvisioner{ - coreBuildProvisioner{&MockProvisioner{}, []interface{}{42}}, + {&MockProvisioner{}, []interface{}{42}}, }, postProcessors: [][]coreBuildPostProcessor{ - []coreBuildPostProcessor{ - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp"}, "testPP", make(map[string]interface{}), true}, + { + {&MockPostProcessor{ArtifactId: "pp"}, "testPP", make(map[string]interface{}), true}, }, }, variables: make(map[string]string), @@ -246,8 +246,8 @@ func TestBuild_Run_Artifacts(t *testing.T) { // inputs, only that post-processors results are returned. build = testBuild() build.postProcessors = [][]coreBuildPostProcessor{ - []coreBuildPostProcessor{ - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp"}, "pp", make(map[string]interface{}), false}, + { + {&MockPostProcessor{ArtifactId: "pp"}, "pp", make(map[string]interface{}), false}, }, } @@ -271,11 +271,11 @@ func TestBuild_Run_Artifacts(t *testing.T) { // keeps the original, the original is kept. build = testBuild() build.postProcessors = [][]coreBuildPostProcessor{ - []coreBuildPostProcessor{ - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp1"}, "pp", make(map[string]interface{}), false}, + { + {&MockPostProcessor{ArtifactId: "pp1"}, "pp", make(map[string]interface{}), false}, }, - []coreBuildPostProcessor{ - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp2"}, "pp", make(map[string]interface{}), true}, + { + {&MockPostProcessor{ArtifactId: "pp2"}, "pp", make(map[string]interface{}), true}, }, } @@ -299,13 +299,13 @@ func TestBuild_Run_Artifacts(t *testing.T) { // want to be. build = testBuild() build.postProcessors = [][]coreBuildPostProcessor{ - []coreBuildPostProcessor{ - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp1a"}, "pp", make(map[string]interface{}), false}, - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp1b"}, "pp", make(map[string]interface{}), true}, + { + {&MockPostProcessor{ArtifactId: "pp1a"}, "pp", make(map[string]interface{}), false}, + {&MockPostProcessor{ArtifactId: "pp1b"}, "pp", make(map[string]interface{}), true}, }, - []coreBuildPostProcessor{ - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp2a"}, "pp", make(map[string]interface{}), false}, - coreBuildPostProcessor{&MockPostProcessor{ArtifactId: "pp2b"}, "pp", make(map[string]interface{}), false}, + { + {&MockPostProcessor{ArtifactId: "pp2a"}, "pp", make(map[string]interface{}), false}, + {&MockPostProcessor{ArtifactId: "pp2b"}, "pp", make(map[string]interface{}), false}, }, } @@ -329,8 +329,8 @@ func TestBuild_Run_Artifacts(t *testing.T) { // keeps inputs, that the artifacts are kept. build = testBuild() build.postProcessors = [][]coreBuildPostProcessor{ - []coreBuildPostProcessor{ - coreBuildPostProcessor{ + { + { &MockPostProcessor{ArtifactId: "pp", Keep: true}, "pp", make(map[string]interface{}), false, }, }, diff --git a/packer/core.go b/packer/core.go index 496fce6bd..860e1808b 100644 --- a/packer/core.go +++ b/packer/core.go @@ -87,7 +87,7 @@ func NewCore(c *CoreConfig) (*Core, error) { // BuildNames returns the builds that are available in this configured core. func (c *Core) BuildNames() []string { r := make([]string, 0, len(c.builds)) - for n, _ := range c.builds { + for n := range c.builds { r = append(r, n) } sort.Strings(r) diff --git a/packer/hook_test.go b/packer/hook_test.go index 1106ee961..3830cd26a 100644 --- a/packer/hook_test.go +++ b/packer/hook_test.go @@ -74,7 +74,7 @@ func TestDispatchHook_cancel(t *testing.T) { dh := &DispatchHook{ Mapping: map[string][]Hook{ - "foo": []Hook{hook}, + "foo": {hook}, }, } diff --git a/packer/plugin/client.go b/packer/plugin/client.go index 36a5ce5a1..e4eabfa3a 100644 --- a/packer/plugin/client.go +++ b/packer/plugin/client.go @@ -291,7 +291,7 @@ func (c *Client) Start() (addr net.Addr, err error) { // so they dont' block since it is an io.Pipe defer func() { go func() { - for _ = range linesCh { + for range linesCh { } }() }() diff --git a/provisioner/chef-client/provisioner.go b/provisioner/chef-client/provisioner.go index 33304d983..8fc8de4c3 100644 --- a/provisioner/chef-client/provisioner.go +++ b/provisioner/chef-client/provisioner.go @@ -28,13 +28,13 @@ type guestOSTypeConfig struct { } var guestOSTypeConfigs = map[string]guestOSTypeConfig{ - provisioner.UnixOSType: guestOSTypeConfig{ + provisioner.UnixOSType: { executeCommand: "{{if .Sudo}}sudo {{end}}chef-client --no-color -c {{.ConfigPath}} -j {{.JsonPath}}", installCommand: "curl -L https://www.chef.io/chef/install.sh | {{if .Sudo}}sudo {{end}}bash", knifeCommand: "{{if .Sudo}}sudo {{end}}knife {{.Args}} {{.Flags}}", stagingDir: "/tmp/packer-chef-client", }, - provisioner.WindowsOSType: guestOSTypeConfig{ + provisioner.WindowsOSType: { executeCommand: "c:/opscode/chef/bin/chef-client.bat --no-color -c {{.ConfigPath}} -j {{.JsonPath}}", installCommand: "powershell.exe -Command \"(New-Object System.Net.WebClient).DownloadFile('http://chef.io/chef/install.msi', 'C:\\Windows\\Temp\\chef.msi');Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait\"", knifeCommand: "c:/opscode/chef/bin/knife.bat {{.Args}} {{.Flags}}", diff --git a/provisioner/chef-solo/provisioner.go b/provisioner/chef-solo/provisioner.go index 3ff0bba1d..c4ca5fd61 100644 --- a/provisioner/chef-solo/provisioner.go +++ b/provisioner/chef-solo/provisioner.go @@ -26,12 +26,12 @@ type guestOSTypeConfig struct { } var guestOSTypeConfigs = map[string]guestOSTypeConfig{ - provisioner.UnixOSType: guestOSTypeConfig{ + provisioner.UnixOSType: { executeCommand: "{{if .Sudo}}sudo {{end}}chef-solo --no-color -c {{.ConfigPath}} -j {{.JsonPath}}", installCommand: "curl -L https://omnitruck.chef.io/install.sh | {{if .Sudo}}sudo {{end}}bash", stagingDir: "/tmp/packer-chef-solo", }, - provisioner.WindowsOSType: guestOSTypeConfig{ + provisioner.WindowsOSType: { executeCommand: "c:/opscode/chef/bin/chef-solo.bat --no-color -c {{.ConfigPath}} -j {{.JsonPath}}", installCommand: "powershell.exe -Command \". { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install\"", stagingDir: "C:/Windows/Temp/packer-chef-solo", diff --git a/provisioner/guest_commands.go b/provisioner/guest_commands.go index 0403ec55b..715d6cb31 100644 --- a/provisioner/guest_commands.go +++ b/provisioner/guest_commands.go @@ -16,12 +16,12 @@ type guestOSTypeCommand struct { } var guestOSTypeCommands = map[string]guestOSTypeCommand{ - UnixOSType: guestOSTypeCommand{ + UnixOSType: { chmod: "chmod %s '%s'", mkdir: "mkdir -p '%s'", removeDir: "rm -rf '%s'", }, - WindowsOSType: guestOSTypeCommand{ + WindowsOSType: { chmod: "echo 'skipping chmod %s %s'", // no-op mkdir: "powershell.exe -Command \"New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path %s\"", removeDir: "powershell.exe -Command \"rm %s -recurse -force\"", diff --git a/template/interpolate/parse_test.go b/template/interpolate/parse_test.go index 3398ddbf1..abe499e54 100644 --- a/template/interpolate/parse_test.go +++ b/template/interpolate/parse_test.go @@ -19,7 +19,7 @@ func TestFunctionsCalled(t *testing.T) { { "foo {{user `bar`}}", map[string]struct{}{ - "user": struct{}{}, + "user": {}, }, }, } diff --git a/template/parse_test.go b/template/parse_test.go index 58414ad3a..d20b01849 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -21,7 +21,7 @@ func TestParse(t *testing.T) { "parse-basic.json", &Template{ Builders: map[string]*Builder{ - "something": &Builder{ + "something": { Name: "something", Type: "something", }, @@ -47,7 +47,7 @@ func TestParse(t *testing.T) { "parse-provisioner-basic.json", &Template{ Provisioners: []*Provisioner{ - &Provisioner{ + { Type: "something", }, }, @@ -59,7 +59,7 @@ func TestParse(t *testing.T) { "parse-provisioner-pause-before.json", &Template{ Provisioners: []*Provisioner{ - &Provisioner{ + { Type: "something", PauseBefore: 1 * time.Second, }, @@ -72,7 +72,7 @@ func TestParse(t *testing.T) { "parse-provisioner-only.json", &Template{ Provisioners: []*Provisioner{ - &Provisioner{ + { Type: "something", OnlyExcept: OnlyExcept{ Only: []string{"foo"}, @@ -87,7 +87,7 @@ func TestParse(t *testing.T) { "parse-provisioner-except.json", &Template{ Provisioners: []*Provisioner{ - &Provisioner{ + { Type: "something", OnlyExcept: OnlyExcept{ Except: []string{"foo"}, @@ -102,7 +102,7 @@ func TestParse(t *testing.T) { "parse-provisioner-override.json", &Template{ Provisioners: []*Provisioner{ - &Provisioner{ + { Type: "something", Override: map[string]interface{}{ "foo": map[string]interface{}{}, @@ -123,7 +123,7 @@ func TestParse(t *testing.T) { "parse-variable-default.json", &Template{ Variables: map[string]*Variable{ - "foo": &Variable{ + "foo": { Default: "foo", }, }, @@ -135,7 +135,7 @@ func TestParse(t *testing.T) { "parse-variable-required.json", &Template{ Variables: map[string]*Variable{ - "foo": &Variable{ + "foo": { Required: true, }, }, @@ -147,8 +147,8 @@ func TestParse(t *testing.T) { "parse-pp-basic.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", Config: map[string]interface{}{ "foo": "bar", @@ -164,8 +164,8 @@ func TestParse(t *testing.T) { "parse-pp-keep.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", KeepInputArtifact: true, }, @@ -179,8 +179,8 @@ func TestParse(t *testing.T) { "parse-pp-only.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", OnlyExcept: OnlyExcept{ Only: []string{"bar"}, @@ -196,8 +196,8 @@ func TestParse(t *testing.T) { "parse-pp-except.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", OnlyExcept: OnlyExcept{ Except: []string{"bar"}, @@ -213,8 +213,8 @@ func TestParse(t *testing.T) { "parse-pp-string.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", }, }, @@ -227,8 +227,8 @@ func TestParse(t *testing.T) { "parse-pp-map.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", }, }, @@ -241,13 +241,13 @@ func TestParse(t *testing.T) { "parse-pp-slice.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", }, }, - []*PostProcessor{ - &PostProcessor{ + { + { Type: "bar", }, }, @@ -260,11 +260,11 @@ func TestParse(t *testing.T) { "parse-pp-multi.json", &Template{ PostProcessors: [][]*PostProcessor{ - []*PostProcessor{ - &PostProcessor{ + { + { Type: "foo", }, - &PostProcessor{ + { Type: "bar", }, }, @@ -309,7 +309,7 @@ func TestParse(t *testing.T) { "parse-comment.json", &Template{ Builders: map[string]*Builder{ - "something": &Builder{ + "something": { Name: "something", Type: "something", }, diff --git a/template/template.go b/template/template.go index a22e78b95..389320c77 100644 --- a/template/template.go +++ b/template/template.go @@ -107,7 +107,7 @@ func (t *Template) Validate() error { } // Validate overrides - for name, _ := range p.Override { + for name := range p.Override { if _, ok := t.Builders[name]; !ok { err = multierror.Append(err, fmt.Errorf( "provisioner %d: override '%s' doesn't exist",