Skip to content

Commit a60b337

Browse files
committed
fix an issue with hasPorts variable - further simplification
1 parent 6ccc6e7 commit a60b337

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

cmd/minikube/cmd/start.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -1286,13 +1286,12 @@ func validateImageRepository(imageRepo string) (validImageRepo string) {
12861286
klog.Errorln("Error Parsing URL: ", err)
12871287
}
12881288

1289-
var hasPorts = false
12901289
var imageRepoPort string
12911290

12921291
if URL.Port() != "" && strings.Contains(imageRepo, ":"+URL.Port()) {
1293-
hasPorts = true
12941292
imageRepoPort = ":" + URL.Port()
12951293
}
1294+
12961295
// tips when imageRepo ended with a trailing /.
12971296
if strings.HasSuffix(imageRepo, "/") {
12981297
out.Infof("The --image-repository flag your provided ended with a trailing / that could cause conflict in kuberentes, removed automatically")
@@ -1301,12 +1300,8 @@ func validateImageRepository(imageRepo string) (validImageRepo string) {
13011300
if URL.Scheme != "" {
13021301
out.Infof("The --image-repository flag your provided contains Scheme: {{.scheme}}, which will be removed automatically", out.V{"scheme": URL.Scheme})
13031302
}
1304-
1305-
if hasPorts {
1306-
validImageRepo = URL.Hostname() + imageRepoPort + strings.TrimSuffix(URL.Path, "/")
1307-
} else {
1308-
validImageRepo = URL.Hostname() + strings.TrimSuffix(URL.Path, "/")
1309-
}
1303+
1304+
validImageRepo = URL.Hostname() + imageRepoPort + strings.TrimSuffix(URL.Path, "/")
13101305

13111306
return validImageRepo
13121307
}

0 commit comments

Comments
 (0)