Commit d377859b authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use a loop

parent fc9a8a29
...@@ -57,13 +57,11 @@ func mustParseAddress(address, scheme string) string { ...@@ -57,13 +57,11 @@ func mustParseAddress(address, scheme string) string {
panic("TLS is not supported for backend connections") panic("TLS is not supported for backend connections")
} }
if host, port, err := net.SplitHostPort(address); err == nil && host != "" && port != "" { for _, suffix := range []string{"", ":" + scheme} {
return host + ":" + port address += suffix
} if host, port, err := net.SplitHostPort(address); err == nil && host != "" && port != "" {
return host + ":" + port
address = address + ":" + scheme }
if host, port, err := net.SplitHostPort(address); err == nil && host != "" && port != "" {
return host + ":" + port
} }
panic("could not parse host:port from address and scheme") panic("could not parse host:port from address and scheme")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment