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 { if strings.Count(addr, ":") > 0 {
host = fmt.Sprintf("[%s]", addr) 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) return fmt.Sprintf("%s:%v", host, port)
} }

View File

@ -18,4 +18,9 @@ func TestListen(t *testing.T) {
} }
defer l.Close() defer l.Close()
} }
// TODO nats case test
// natsAddr := "_INBOX.bID2CMRvlNp0vt4tgNBHWf"
// Expect addr DO NOT has extra ":" at the end!
} }