Nats addr fix https://github.com/micro/go-micro/pull/648
This commit is contained in:
parent
e16420fdbd
commit
000431f489
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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!
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user