From bfb65b733a2cfa0dac6a5760897f09d8e2557381 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 24 May 2013 11:31:36 -0700 Subject: [PATCH] Simplify the Host flag parsing --- docker/docker.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/docker.go b/docker/docker.go index 1749b2fd39..7b8aa7f858 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -40,15 +40,19 @@ func main() { docker.NetworkBridgeIface = docker.DefaultNetworkBridge } - if strings.Contains(*flHost, ":") && len(strings.Split(*flHost, ":")) == 2 { + if strings.Contains(*flHost, ":") { hostParts := strings.Split(*flHost, ":") + if len(hostParts) != 2 { + log.Fatal("Invalid bind address format.") + os.Exit(-1) + } if hostParts[0] != "" { host = hostParts[0] } if p, err := strconv.Atoi(hostParts[1]); err == nil { port = p } - } else if !strings.Contains(*flHost, ":") { + } else { host = *flHost }