|
|
|
instance: add HostPort type
We want this to return it from the API, amongst
other places.
https://code.launchpad.net/~rogpeppe/juju-core/522-instance-hostport/+merge/211525
(do not edit description out of merge proposal)
Patch Set 1 #Patch Set 2 : instance: add HostPort type #
Total comments: 4
Total messages: 4
|
rog
Please take a look.
|
11 years, 9 months ago (2014年03月18日 13:33:36 UTC) #1 | |||||||||||||||||||||||||||||
Please take a look.
LGTM. https://codereview.appspot.com/77410043/diff/20001/instance/address.go File instance/address.go (right): https://codereview.appspot.com/77410043/diff/20001/instance/address.go#newcode55 instance/address.go:55: hps[i] = HostPort{ Oh, interesting, I've been using append to do this stuff rather than assigning to an index. https://codereview.appspot.com/77410043/diff/20001/instance/address.go#newcode66 instance/address.go:66: return net.JoinHostPort(hp.Value, strconv.FormatInt(int64(hp.Port), 10)) I giggle at the dance to turn an int into a string. https://codereview.appspot.com/77410043/diff/20001/instance/address_test.go File instance/address_test.go (right): https://codereview.appspot.com/77410043/diff/20001/instance/address_test.go#n... instance/address_test.go:271: expect: "[2001:DB8::1]:100", Yeay, ipv6.
https://codereview.appspot.com/77410043/diff/20001/instance/address.go File instance/address.go (right): https://codereview.appspot.com/77410043/diff/20001/instance/address.go#newcode66 instance/address.go:66: return net.JoinHostPort(hp.Value, strconv.FormatInt(int64(hp.Port), 10)) On 2014年03月18日 14:01:32, gz wrote: > I giggle at the dance to turn an int into a string. fmt.Sprint(hp.Port) would have been shorter, but I didn't really want to depend on fmt here.
On 2014年03月18日 15:11:02, rog wrote: > https://codereview.appspot.com/77410043/diff/20001/instance/address.go > File instance/address.go (right): > > https://codereview.appspot.com/77410043/diff/20001/instance/address.go#newcode66 > instance/address.go:66: return net.JoinHostPort(hp.Value, > strconv.FormatInt(int64(hp.Port), 10)) > On 2014年03月18日 14:01:32, gz wrote: > > I giggle at the dance to turn an int into a string. > > fmt.Sprint(hp.Port) would have been shorter, but I didn't really want to depend > on fmt here. ha, colour me stupid. strconv.Itoa is considerably better here.