From 346f5d9bbab22c976e8b2e6d6d30acb094c512c2 Mon Sep 17 00:00:00 2001 From: Ed Maxwell-Lyte <2248005+edwardmlyte@users.noreply.github.com> Date: Wed, 9 Jan 2019 08:45:01 +0000 Subject: [PATCH] Simplify version check for port count argument Might be personal preference, but I think this reads more clearly --- builder/virtualbox/common/driver_4_2.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/builder/virtualbox/common/driver_4_2.go b/builder/virtualbox/common/driver_4_2.go index 1a2c8541d..6dddd3689 100644 --- a/builder/virtualbox/common/driver_4_2.go +++ b/builder/virtualbox/common/driver_4_2.go @@ -25,10 +25,11 @@ func (d *VBox42Driver) CreateSATAController(vmName string, name string, portcoun } portCountArg := "--portcount" - if strings.HasPrefix(version, "0.") || strings.HasPrefix(version, "1.") || strings.HasPrefix(version, "2.") || - strings.HasPrefix(version, "3.") || strings.HasPrefix(version, "4.0") || strings.HasPrefix(version, "4.1") || - strings.HasPrefix(version, "4.2") { - portCountArg = "--sataportcount" + + for _, prefix := range [7]string{"0.", "1.", "2.", "3.", "4.0", "4.1", "4.2"} { + if strings.HasPrefix(version, prefix) { + portCountArg = "--sataportcount" + } } command := []string{