From 634c2d5a96ad1ed6e56381d86e45f20c4a33d04e Mon Sep 17 00:00:00 2001 From: baozhecheng Date: Tue, 23 Aug 2022 14:31:20 +0800 Subject: [PATCH] fix --- contrib/registry/consul/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/registry/consul/client.go b/contrib/registry/consul/client.go index f2fdfefac..6a59697f7 100644 --- a/contrib/registry/consul/client.go +++ b/contrib/registry/consul/client.go @@ -138,6 +138,11 @@ func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enab port, _ := strconv.ParseInt(portRaw, 10, 32) asr.Address = host asr.Port = int(port) + + if c.registryPortByScheme == "" { + break + } + if strings.HasPrefix(address, c.registryPortByScheme) { host, portRaw, _ = net.SplitHostPort(address) port, _ = strconv.ParseInt(portRaw, 10, 32)