From a86c26d485d822f9a16d924edaf5104026b4d451 Mon Sep 17 00:00:00 2001 From: lpxxn Date: Fri, 31 May 2019 14:24:37 +0800 Subject: [PATCH] fix bug need pass the variable as a parameter to the anonymous function --- client/rpc_client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/rpc_client.go b/client/rpc_client.go index e02744e2..5e8d0f59 100644 --- a/client/rpc_client.go +++ b/client/rpc_client.go @@ -467,10 +467,10 @@ func (r *rpcClient) Stream(ctx context.Context, request Request, opts ...CallOpt var grr error for i := 0; i <= callOpts.Retries; i++ { - go func() { + go func(i int) { s, err := call(i) ch <- response{s, err} - }() + }(i) select { case <-ctx.Done():