Merge pull request #546 from lpxxn/master
pass parameter to anonymous function
This commit is contained in:
commit
4bee5c1b2b
@ -372,9 +372,9 @@ func (g *grpcClient) Call(ctx context.Context, req client.Request, rsp interface
|
|||||||
var gerr error
|
var gerr error
|
||||||
|
|
||||||
for i := 0; i <= callOpts.Retries; i++ {
|
for i := 0; i <= callOpts.Retries; i++ {
|
||||||
go func() {
|
go func(i int) {
|
||||||
ch <- call(i)
|
ch <- call(i)
|
||||||
}()
|
}(i)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@ -455,10 +455,10 @@ func (g *grpcClient) Stream(ctx context.Context, req client.Request, opts ...cli
|
|||||||
var grr error
|
var grr error
|
||||||
|
|
||||||
for i := 0; i <= callOpts.Retries; i++ {
|
for i := 0; i <= callOpts.Retries; i++ {
|
||||||
go func() {
|
go func(i int) {
|
||||||
s, err := call(i)
|
s, err := call(i)
|
||||||
ch <- response{s, err}
|
ch <- response{s, err}
|
||||||
}()
|
}(i)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user