From 1ca841b4997e118bd2dd98f68959d5cfe0276e86 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sun, 11 Dec 2016 23:12:55 +0200 Subject: [PATCH] Fix shadowed declarations Performed by "go vet" tool --- builder/parallels/common/artifact_test.go | 2 +- .../parallels/common/step_attach_parallels_tools.go | 2 +- builder/parallels/common/step_compact_disk.go | 2 +- builder/parallels/common/step_prlctl.go | 4 ++-- builder/parallels/common/step_run.go | 2 +- builder/parallels/common/step_shutdown.go | 4 ++-- builder/parallels/common/step_type_boot_command.go | 12 ++++++------ .../parallels/common/step_upload_parallels_tools.go | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/builder/parallels/common/artifact_test.go b/builder/parallels/common/artifact_test.go index f9ddc5dbf..3f2438200 100644 --- a/builder/parallels/common/artifact_test.go +++ b/builder/parallels/common/artifact_test.go @@ -25,7 +25,7 @@ func TestNewArtifact(t *testing.T) { t.Fatalf("err: %s", err) } - if err := os.Mkdir(filepath.Join(td, "b"), 0755); err != nil { + if err = os.Mkdir(filepath.Join(td, "b"), 0755); err != nil { t.Fatalf("err: %s", err) } diff --git a/builder/parallels/common/step_attach_parallels_tools.go b/builder/parallels/common/step_attach_parallels_tools.go index aeadceb31..380a00666 100644 --- a/builder/parallels/common/step_attach_parallels_tools.go +++ b/builder/parallels/common/step_attach_parallels_tools.go @@ -43,7 +43,7 @@ func (s *StepAttachParallelsTools) Run(state multistep.StateBag) multistep.StepA cdrom, err := driver.DeviceAddCDROM(vmName, parallelsToolsPath) if err != nil { - err := fmt.Errorf("Error attaching Parallels Tools ISO: %s", err) + err = fmt.Errorf("Error attaching Parallels Tools ISO: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/builder/parallels/common/step_compact_disk.go b/builder/parallels/common/step_compact_disk.go index 21362c789..6f609a87c 100644 --- a/builder/parallels/common/step_compact_disk.go +++ b/builder/parallels/common/step_compact_disk.go @@ -34,7 +34,7 @@ func (s *StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Compacting the disk image") diskPath, err := driver.DiskPath(vmName) if err != nil { - err := fmt.Errorf("Error detecting virtual disk path: %s", err) + err = fmt.Errorf("Error detecting virtual disk path: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/builder/parallels/common/step_prlctl.go b/builder/parallels/common/step_prlctl.go index 048ab0a3f..6f8c9b0f2 100644 --- a/builder/parallels/common/step_prlctl.go +++ b/builder/parallels/common/step_prlctl.go @@ -48,7 +48,7 @@ func (s *StepPrlctl) Run(state multistep.StateBag) multistep.StepAction { var err error command[i], err = interpolate.Render(arg, &s.Ctx) if err != nil { - err := fmt.Errorf("Error preparing prlctl command: %s", err) + err = fmt.Errorf("Error preparing prlctl command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -57,7 +57,7 @@ func (s *StepPrlctl) Run(state multistep.StateBag) multistep.StepAction { ui.Message(fmt.Sprintf("Executing: prlctl %s", strings.Join(command, " "))) if err := driver.Prlctl(command...); err != nil { - err := fmt.Errorf("Error executing command: %s", err) + err = fmt.Errorf("Error executing command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/builder/parallels/common/step_run.go b/builder/parallels/common/step_run.go index 9ff5afe58..c0f4d13ff 100644 --- a/builder/parallels/common/step_run.go +++ b/builder/parallels/common/step_run.go @@ -30,7 +30,7 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Starting the virtual machine...") command := []string{"start", vmName} if err := driver.Prlctl(command...); err != nil { - err := fmt.Errorf("Error starting VM: %s", err) + err = fmt.Errorf("Error starting VM: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/builder/parallels/common/step_shutdown.go b/builder/parallels/common/step_shutdown.go index b0b33f32b..9f533cbd4 100644 --- a/builder/parallels/common/step_shutdown.go +++ b/builder/parallels/common/step_shutdown.go @@ -37,7 +37,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { log.Printf("Executing shutdown command: %s", s.Command) cmd := &packer.RemoteCmd{Command: s.Command} if err := cmd.StartWithUi(comm, ui); err != nil { - err := fmt.Errorf("Failed to send shutdown command: %s", err) + err = fmt.Errorf("Failed to send shutdown command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -65,7 +65,7 @@ func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction { } else { ui.Say("Halting the virtual machine...") if err := driver.Stop(vmName); err != nil { - err := fmt.Errorf("Error stopping VM: %s", err) + err = fmt.Errorf("Error stopping VM: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/builder/parallels/common/step_type_boot_command.go b/builder/parallels/common/step_type_boot_command.go index 37637fc65..3d5e288c6 100644 --- a/builder/parallels/common/step_type_boot_command.go +++ b/builder/parallels/common/step_type_boot_command.go @@ -58,7 +58,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction ip, err := ipFinder.HostIP() if err != nil { - err := fmt.Errorf("Error detecting host IP: %s", err) + err = fmt.Errorf("Error detecting host IP: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -78,7 +78,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction for i, command := range s.BootCommand { command, err := interpolate.Render(command, &s.Ctx) if err != nil { - err := fmt.Errorf("Error preparing boot command: %s", err) + err = fmt.Errorf("Error preparing boot command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -88,7 +88,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction for _, code := range scancodes(command) { if code == "wait" { if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil { - err := fmt.Errorf("Error sending boot command: %s", err) + err = fmt.Errorf("Error sending boot command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -100,7 +100,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction if code == "wait5" { if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil { - err := fmt.Errorf("Error sending boot command: %s", err) + err = fmt.Errorf("Error sending boot command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -112,7 +112,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction if code == "wait10" { if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil { - err := fmt.Errorf("Error sending boot command: %s", err) + err = fmt.Errorf("Error sending boot command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -136,7 +136,7 @@ func (s *StepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction log.Printf("Sending scancodes: %#v", codes) if err := driver.SendKeyScanCodes(s.VMName, codes...); err != nil { - err := fmt.Errorf("Error sending boot command: %s", err) + err = fmt.Errorf("Error sending boot command: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt diff --git a/builder/parallels/common/step_upload_parallels_tools.go b/builder/parallels/common/step_upload_parallels_tools.go index 6afe49677..a3c0d62ba 100644 --- a/builder/parallels/common/step_upload_parallels_tools.go +++ b/builder/parallels/common/step_upload_parallels_tools.go @@ -56,7 +56,7 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA s.ParallelsToolsGuestPath, err = interpolate.Render(s.ParallelsToolsGuestPath, &s.Ctx) if err != nil { - err := fmt.Errorf("Error preparing Parallels Tools path: %s", err) + err = fmt.Errorf("Error preparing Parallels Tools path: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt @@ -65,7 +65,7 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA ui.Say(fmt.Sprintf("Uploading Parallels Tools for '%s' to path: '%s'", s.ParallelsToolsFlavor, s.ParallelsToolsGuestPath)) if err := comm.Upload(s.ParallelsToolsGuestPath, f, nil); err != nil { - err := fmt.Errorf("Error uploading Parallels Tools: %s", err) + err = fmt.Errorf("Error uploading Parallels Tools: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt