func TestJoinHostPort(t *testing.T) { result := "127.0.0.1:8000" if nets.JoinHostPort("127.0.0.1", "8000") != result { t.Fail() } if nets.JoinHostPort("127.0.0.1", 8000) != result { t.Fail() } if nets.JoinHostPort([]byte("127.0.0.1"), 8000) != result { t.Fail() } if nets.JoinHostPort([]byte("127.0.0.1"), "8000") != result { t.Fail() } }
// DialTCP is the same as DialTCPWithAddr, but it joins host and port firstly. func DialTCP(host, port interface{}) (*net.TCPConn, error) { addr := nets.JoinHostPort(host, port) return DialTCPWithAddr(addr) }