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{