diff --git a/internal/client/v1/client/discoverer/discover.go b/internal/client/v1/client/discoverer/discover.go index 382c68bfb7..b84b2f411c 100644 --- a/internal/client/v1/client/discoverer/discover.go +++ b/internal/client/v1/client/discoverer/discover.go @@ -98,43 +98,43 @@ func (c *client) Start(ctx context.Context) (<-chan error, error) { } } - addrs, err :=c.updateDiscoveryInfo(ctx) + addrs, err := c.updateDiscoveryInfo(ctx) if err != nil || len(addrs) == 0 { - addrs, err = c.dnsDiscovery(ctx) - if err != nil { - return nil, err - } + addrs, err = c.dnsDiscovery(ctx) + if err != nil { + return nil, err + } } var aech <-chan error if c.client == nil { - c.client = grpc.New( - append( - c.opts, - grpc.WithAddrs(addrs...), - grpc.WithErrGroup(c.eg), - )..., - ) - aech, err = c.client.StartConnectionMonitor(ctx) - if err != nil { - return nil, err - } + c.client = grpc.New( + append( + c.opts, + grpc.WithAddrs(addrs...), + grpc.WithErrGroup(c.eg), + )..., + ) + aech, err = c.client.StartConnectionMonitor(ctx) + if err != nil { + return nil, err + } for _, addr := range addrs { - if c.onConnect != nil { - err = c.onConnect(ctx, c, addr) - if err != nil { - return nil, err - } - } + if c.onConnect != nil { + err = c.onConnect(ctx, c, addr) + if err != nil { + return nil, err + } + } } } else { for _, addr := range addrs { - err = c.connect(ctx, addr) + err = c.connect(ctx, addr) if err != nil { return nil, err } } - aech, err = c.client.StartConnectionMonitor(ctx) + aech, err = c.client.StartConnectionMonitor(ctx) } if err != nil { return nil, err @@ -399,12 +399,12 @@ func (c *client) discoverAddrs( len(node.GetPods().GetPods()) > i && len(node.GetPods().GetPods()[i].GetIp()) != 0 { addr := net.JoinHostPort(node.GetPods().GetPods()[i].GetIp(), uint16(c.port)) - if err = c.connect(ctx, addr); err != nil { - log.Debugf("resource based discovery connect from discoverer API for addr = %s failed %v", addr, errors.ErrAddrCouldNotDiscover(err, addr)) - err = nil - } else { - addrs = append(addrs, addr) - } + if err = c.connect(ctx, addr); err != nil { + log.Debugf("resource based discovery connect from discoverer API for addr = %s failed %v", addr, errors.ErrAddrCouldNotDiscover(err, addr)) + err = nil + } else { + addrs = append(addrs, addr) + } } }