diff --git a/util/net/net.go b/util/net/net.go index 7f0f4643..678e2568 100644 --- a/util/net/net.go +++ b/util/net/net.go @@ -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) } diff --git a/util/net/net_test.go b/util/net/net_test.go index a9fca743..d8516d88 100644 --- a/util/net/net_test.go +++ b/util/net/net_test.go @@ -18,4 +18,9 @@ func TestListen(t *testing.T) { } defer l.Close() } + + // TODO nats case test + // natsAddr := "_INBOX.bID2CMRvlNp0vt4tgNBHWf" + // Expect addr DO NOT has extra ":" at the end! + }