From 2cfba56265018ae62de3493384e8cfd69940346b Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Tue, 7 May 2019 16:44:29 -0700 Subject: [PATCH] fix typos --- builder/amazon/chroot/builder.go | 7 +++---- builder/amazon/chroot/step_register_ami.go | 3 +-- builder/amazon/ebssurrogate/builder.go | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index 328b17d29..af075b6cf 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -83,7 +83,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } if b.config.Architecture == "" { - b.config.Architecture == "x86_64" + b.config.Architecture = "x86_64" } if b.config.PackerConfig.PackerForce { @@ -186,9 +186,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } } valid := false - for validArch, _ := range []string{"x86_64", "arm64"} { + for _, validArch := range []string{"x86_64", "arm64"} { if validArch == b.config.Architecture { - matched = true + valid = true break } } @@ -291,7 +291,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack RootVolumeSize: b.config.RootVolumeSize, EnableAMISriovNetSupport: b.config.AMISriovNetSupport, EnableAMIENASupport: b.config.AMIENASupport, - Architecture: b.config.Architecture, }, &awscommon.StepAMIRegionCopy{ AccessConfig: &b.config.AccessConfig, diff --git a/builder/amazon/chroot/step_register_ami.go b/builder/amazon/chroot/step_register_ami.go index 52aa8a442..229c79dcd 100644 --- a/builder/amazon/chroot/step_register_ami.go +++ b/builder/amazon/chroot/step_register_ami.go @@ -16,7 +16,6 @@ type StepRegisterAMI struct { RootVolumeSize int64 EnableAMIENASupport *bool EnableAMISriovNetSupport bool - Architecture string } func (s *StepRegisterAMI) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -118,7 +117,7 @@ func buildBaseRegisterOpts(config *Config, sourceImage *ec2.Image, rootVolumeSiz if config.FromScratch { return &ec2.RegisterImageInput{ Name: &config.AMIName, - Architecture: aws.String(s.Architecture), + Architecture: aws.String(config.Architecture), RootDeviceName: aws.String(rootDeviceName), VirtualizationType: aws.String(config.AMIVirtType), BlockDeviceMappings: newMappings, diff --git a/builder/amazon/ebssurrogate/builder.go b/builder/amazon/ebssurrogate/builder.go index 5153577d6..6ea3bc9a7 100644 --- a/builder/amazon/ebssurrogate/builder.go +++ b/builder/amazon/ebssurrogate/builder.go @@ -94,12 +94,12 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { } if b.config.Architecture == "" { - b.config.Architecture == "x86_64" + b.config.Architecture = "x86_64" } valid := false - for validArch, _ := range []string{"x86_64", "arm64"} { + for _, validArch := range []string{"x86_64", "arm64"} { if validArch == b.config.Architecture { - matched = true + valid = true break } }