diff --git a/contrib/registry/consul/client.go b/contrib/registry/consul/client.go index ed505974a..46321b8e2 100644 --- a/contrib/registry/consul/client.go +++ b/contrib/registry/consul/client.go @@ -98,7 +98,8 @@ func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enab } addr := raw.Hostname() port, _ := strconv.ParseUint(raw.Port(), 10, 16) - checkAddresses = append(checkAddresses, fmt.Sprintf("%s:%d", addr, port)) + + checkAddresses = append(checkAddresses, net.JoinHostPort(addr, strconv.FormatUint(port, 10))) addresses[raw.Scheme] = api.ServiceAddress{Address: endpoint, Port: int(port)} } asr := &api.AgentServiceRegistration{