diff --git a/builder/hyperv/common/step_create_external_switch.go b/builder/hyperv/common/step_create_external_switch.go index c5ebd43bf..df1776a63 100644 --- a/builder/hyperv/common/step_create_external_switch.go +++ b/builder/hyperv/common/step_create_external_switch.go @@ -84,8 +84,6 @@ func (s *StepCreateExternalSwitch) Cleanup(state multistep.StateBag) { ui.Say("Unregistering and deleting external switch...") - var err error = nil - errMsg := "Error deleting external switch: %s" // connect the vm to the old switch @@ -94,7 +92,7 @@ func (s *StepCreateExternalSwitch) Cleanup(state multistep.StateBag) { return } - err = driver.ConnectVirtualMachineNetworkAdapterToSwitch(vmName, s.oldSwitchName) + err := driver.ConnectVirtualMachineNetworkAdapterToSwitch(vmName, s.oldSwitchName) if err != nil { ui.Error(fmt.Sprintf(errMsg, err)) return