From 0719f906d444c334c8903707c6836d351708966c Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Wed, 9 Sep 2020 04:24:17 -0400 Subject: [PATCH] Replace if/else with simple if (#9913) --- builder/qemu/step_run.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 9b05a54e1..daf29655c 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -73,12 +73,11 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error var deviceArgs []string var driveArgs []string var commHostPort int - var vnc string - if !config.VNCUsePassword { - vnc = fmt.Sprintf("%s:%d", vncIP, vncPort-config.VNCPortMin) - } else { - vnc = fmt.Sprintf("%s:%d,password", vncIP, vncPort-config.VNCPortMin) + vncPort = vncPort - config.VNCPortMin + vnc := fmt.Sprintf("%s:%d", vncIP, vncPort) + if config.VNCUsePassword { + vnc = fmt.Sprintf("%s:%d,password", vncIP, vncPort) } if config.QMPEnable {