This commit is contained in:
Asim Aslam
2019-08-06 09:15:54 +01:00
parent e16420fdbd
commit 000431f489
2 changed files with 11 additions and 0 deletions

View File

@@ -14,6 +14,12 @@ func HostPort(addr string, port interface{}) string {
if strings.Count(addr, ":") > 0 {
host = fmt.Sprintf("[%s]", addr)
}
// TODO check for NATS case
if v, ok := port.(string); ok {
if v == "" {
return fmt.Sprintf("%s", host)
}
}
return fmt.Sprintf("%s:%v", host, port)
}