From d2a9e6b32e9c2584e947865df0f01cdefb40060c Mon Sep 17 00:00:00 2001 From: nywilken Date: Tue, 28 Jan 2020 16:49:16 -0500 Subject: [PATCH] Format code with `gofmt -s -w` --- builder/amazon/chroot/step_register_ami_test.go | 4 ++-- builder/amazon/common/step_ami_region_copy.go | 2 +- builder/amazon/common/step_pre_validate_test.go | 2 +- builder/qemu/builder_test.go | 12 ++++++------ builder/tencentcloud/cvm/step_run_instance.go | 2 +- fix/fixer_test.go | 2 +- hcl2template/types.packer_config_test.go | 2 +- hcl2template/types.source_test.go | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/builder/amazon/chroot/step_register_ami_test.go b/builder/amazon/chroot/step_register_ami_test.go index 72922c7e6..6a9de18f6 100644 --- a/builder/amazon/chroot/step_register_ami_test.go +++ b/builder/amazon/chroot/step_register_ami_test.go @@ -93,7 +93,7 @@ func TestStepRegisterAmi_buildRegisterOptsFromScratch(t *testing.T) { FromScratch: true, PackerConfig: common.PackerConfig{}, AMIMappings: []amazon.BlockDevice{ - amazon.BlockDevice{ + { DeviceName: rootDeviceName, }, }, @@ -168,7 +168,7 @@ func TestStepRegisterAmi_buildRegisterOptFromExistingImageWithBlockDeviceMapping FromScratch: false, PackerConfig: common.PackerConfig{}, AMIMappings: []amazon.BlockDevice{ - amazon.BlockDevice{ + { DeviceName: rootDeviceName, }, }, diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index b896b18f3..f30b8f415 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -54,7 +54,7 @@ func (s *StepAMIRegionCopy) DeduplicateRegions(intermediary bool) { } // Now print all those keys into the region slice again - for k, _ := range RegionMap { + for k := range RegionMap { RegionSlice = append(RegionSlice, k) } diff --git a/builder/amazon/common/step_pre_validate_test.go b/builder/amazon/common/step_pre_validate_test.go index 7863aa870..ffaf946f9 100644 --- a/builder/amazon/common/step_pre_validate_test.go +++ b/builder/amazon/common/step_pre_validate_test.go @@ -26,7 +26,7 @@ func (m *mockEC2Conn) DescribeVpcs(input *ec2.DescribeVpcsInput) (*ec2.DescribeV output := &ec2.DescribeVpcsOutput{ Vpcs: []*ec2.Vpc{ - &ec2.Vpc{IsDefault: aws.Bool(isDefault), + {IsDefault: aws.Bool(isDefault), VpcId: aws.String(vpcID), }, }, diff --git a/builder/qemu/builder_test.go b/builder/qemu/builder_test.go index de52d866c..3221bf635 100644 --- a/builder/qemu/builder_test.go +++ b/builder/qemu/builder_test.go @@ -165,12 +165,12 @@ func TestBuilderPrepare_DiskSize(t *testing.T) { } testCases := []testcase{ - testcase{"", "40960M", false}, // not provided - testcase{"12345", "12345M", false}, // no unit given, defaults to M - testcase{"12345x", "12345x", true}, // invalid unit - testcase{"12345T", "12345T", false}, // terabytes - testcase{"12345b", "12345b", false}, // bytes get preserved when set. - testcase{"60000M", "60000M", false}, // Original test case + {"", "40960M", false}, // not provided + {"12345", "12345M", false}, // no unit given, defaults to M + {"12345x", "12345x", true}, // invalid unit + {"12345T", "12345T", false}, // terabytes + {"12345b", "12345b", false}, // bytes get preserved when set. + {"60000M", "60000M", false}, // Original test case } for _, tc := range testCases { // Set input disk size diff --git a/builder/tencentcloud/cvm/step_run_instance.go b/builder/tencentcloud/cvm/step_run_instance.go index 72f3f7b90..e126f70b5 100644 --- a/builder/tencentcloud/cvm/step_run_instance.go +++ b/builder/tencentcloud/cvm/step_run_instance.go @@ -133,7 +133,7 @@ func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) mul resourceType := "instance" if len(tags) > 0 { req.TagSpecification = []*cvm.TagSpecification{ - &cvm.TagSpecification{ + { ResourceType: &resourceType, Tags: tags, }, diff --git a/fix/fixer_test.go b/fix/fixer_test.go index 820c6dcf3..e6a01fcf5 100644 --- a/fix/fixer_test.go +++ b/fix/fixer_test.go @@ -12,7 +12,7 @@ func TestFix_allFixersEnabled(t *testing.T) { t.Fatalf("Fixers length (%d) does not match FixerOrder length (%d)", len(f), len(o)) } - for fixer, _ := range f { + for fixer := range f { found := false for _, orderedFixer := range o { diff --git a/hcl2template/types.packer_config_test.go b/hcl2template/types.packer_config_test.go index 325f31722..373309310 100644 --- a/hcl2template/types.packer_config_test.go +++ b/hcl2template/types.packer_config_test.go @@ -20,7 +20,7 @@ func TestParser_complete(t *testing.T) { parseTestArgs{"testdata/complete"}, &PackerConfig{ Sources: map[SourceRef]*Source{ - refVBIsoUbuntu1204: &Source{Type: "virtualbox-iso", Name: "ubuntu-1204"}, + refVBIsoUbuntu1204: {Type: "virtualbox-iso", Name: "ubuntu-1204"}, }, Builds: Builds{ &BuildBlock{ diff --git a/hcl2template/types.source_test.go b/hcl2template/types.source_test.go index 66d38860a..2587652a8 100644 --- a/hcl2template/types.source_test.go +++ b/hcl2template/types.source_test.go @@ -15,7 +15,7 @@ func TestParse_source(t *testing.T) { parseTestArgs{"testdata/sources/basic.pkr.hcl"}, &PackerConfig{ Sources: map[SourceRef]*Source{ - SourceRef{ + { Type: "virtualbox-iso", Name: "ubuntu-1204", }: { @@ -57,7 +57,7 @@ func TestParse_source(t *testing.T) { parseTestArgs{"testdata/sources/duplicate.pkr.hcl"}, &PackerConfig{ Sources: map[SourceRef]*Source{ - SourceRef{ + { Type: "virtualbox-iso", Name: "ubuntu-1204", }: {