Auth: declare auth variable inside the loop (#11476)

Co-authored-by: yutedz <54038175+yutedz@users.noreply.github.com>
This commit is contained in:
Ted Yu 2020-01-13 19:23:00 -08:00 committed by Xiang Li
parent 0c787e26bc
commit b95a465235

View File

@ -272,10 +272,10 @@ func (c *Client) Dial(ep string) (*grpc.ClientConn, error) {
func (c *Client) getToken(ctx context.Context) error {
var err error // return last error in a case of fail
var auth *authenticator
eps := c.Endpoints()
for _, ep := range eps {
var auth *authenticator
// use dial options without dopts to avoid reusing the client balancer
var dOpts []grpc.DialOption
_, host, _ := endpoint.ParseEndpoint(ep)