Skip to content

Commit 4e393e0

Browse files
dnephindfawley
authored andcommitted
grpc: fix deprecation comments to conform to standard (grpc#1691)
1 parent 0b24825 commit 4e393e0

18 files changed

+262
-222
lines changed

balancer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"google.golang.org/grpc/credentials"
2929
"google.golang.org/grpc/grpclog"
3030
"google.golang.org/grpc/naming"
31+
"google.golang.org/grpc/status"
3132
)
3233

3334
// Address represents a server the client connects to.
@@ -310,7 +311,7 @@ func (rr *roundRobin) Get(ctx context.Context, opts BalancerGetOptions) (addr Ad
310311
if !opts.BlockingWait {
311312
if len(rr.addrs) == 0 {
312313
rr.mu.Unlock()
313-
err = Errorf(codes.Unavailable, "there is no address available")
314+
err = status.Errorf(codes.Unavailable, "there is no address available")
314315
return
315316
}
316317
// Returns the next addr on rr.addrs for failfast RPCs.

balancer/roundrobin/roundrobin_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"google.golang.org/grpc/balancer"
3131
"google.golang.org/grpc/codes"
3232
_ "google.golang.org/grpc/grpclog/glogger"
33+
"google.golang.org/grpc/internal"
3334
"google.golang.org/grpc/peer"
3435
"google.golang.org/grpc/resolver"
3536
"google.golang.org/grpc/resolver/manual"
@@ -111,7 +112,7 @@ func TestOneBackend(t *testing.T) {
111112
// The first RPC should fail because there's no address.
112113
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
113114
defer cancel()
114-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || grpc.Code(err) != codes.DeadlineExceeded {
115+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || internal.Code(err) != codes.DeadlineExceeded {
115116
t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
116117
}
117118

@@ -143,7 +144,7 @@ func TestBackendsRoundRobin(t *testing.T) {
143144
// The first RPC should fail because there's no address.
144145
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
145146
defer cancel()
146-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || grpc.Code(err) != codes.DeadlineExceeded {
147+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || internal.Code(err) != codes.DeadlineExceeded {
147148
t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
148149
}
149150

@@ -202,7 +203,7 @@ func TestAddressesRemoved(t *testing.T) {
202203
// The first RPC should fail because there's no address.
203204
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
204205
defer cancel()
205-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || grpc.Code(err) != codes.DeadlineExceeded {
206+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || internal.Code(err) != codes.DeadlineExceeded {
206207
t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
207208
}
208209

@@ -216,7 +217,7 @@ func TestAddressesRemoved(t *testing.T) {
216217
for i := 0; i < 1000; i++ {
217218
ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
218219
defer cancel()
219-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); grpc.Code(err) == codes.DeadlineExceeded {
220+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); internal.Code(err) == codes.DeadlineExceeded {
220221
return
221222
}
222223
time.Sleep(time.Millisecond)
@@ -248,7 +249,7 @@ func TestCloseWithPendingRPC(t *testing.T) {
248249
defer wg.Done()
249250
// This RPC blocks until cc is closed.
250251
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
251-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); grpc.Code(err) == codes.DeadlineExceeded {
252+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); internal.Code(err) == codes.DeadlineExceeded {
252253
t.Errorf("RPC failed because of deadline after cc is closed; want error the client connection is closing")
253254
}
254255
cancel()
@@ -278,7 +279,7 @@ func TestNewAddressWhileBlocking(t *testing.T) {
278279
// The first RPC should fail because there's no address.
279280
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
280281
defer cancel()
281-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || grpc.Code(err) != codes.DeadlineExceeded {
282+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || internal.Code(err) != codes.DeadlineExceeded {
282283
t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
283284
}
284285

@@ -327,7 +328,7 @@ func TestOneServerDown(t *testing.T) {
327328
// The first RPC should fail because there's no address.
328329
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
329330
defer cancel()
330-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || grpc.Code(err) != codes.DeadlineExceeded {
331+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || internal.Code(err) != codes.DeadlineExceeded {
331332
t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
332333
}
333334

@@ -425,7 +426,7 @@ func TestAllServersDown(t *testing.T) {
425426
// The first RPC should fail because there's no address.
426427
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
427428
defer cancel()
428-
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || grpc.Code(err) != codes.DeadlineExceeded {
429+
if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || internal.Code(err) != codes.DeadlineExceeded {
429430
t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err)
430431
}
431432

@@ -469,7 +470,7 @@ func TestAllServersDown(t *testing.T) {
469470
}
470471
time.Sleep(100 * time.Millisecond)
471472
for i := 0; i < 1000; i++ {
472-
if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); grpc.Code(err) == codes.Unavailable {
473+
if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); internal.Code(err) == codes.Unavailable {
473474
return
474475
}
475476
time.Sleep(time.Millisecond)

balancer_switching_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func checkPickFirst(cc *ClientConn, servers []*server) error {
3939
)
4040
connected := false
4141
for i := 0; i < 5000; i++ {
42-
if err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc); ErrorDesc(err) == servers[0].port {
42+
if err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc); errorDesc(err) == servers[0].port {
4343
if connected {
4444
// connected is set to false if peer is not server[0]. So if
4545
// connected is true here, this is the second time we saw
@@ -58,7 +58,7 @@ func checkPickFirst(cc *ClientConn, servers []*server) error {
5858
// The following RPCs should all succeed with the first server.
5959
for i := 0; i < 3; i++ {
6060
err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc)
61-
if ErrorDesc(err) != servers[0].port {
61+
if errorDesc(err) != servers[0].port {
6262
return fmt.Errorf("Index %d: want peer %v, got peer %v", i, servers[0].port, err)
6363
}
6464
}
@@ -79,7 +79,7 @@ func checkRoundRobin(cc *ClientConn, servers []*server) error {
7979
for _, s := range servers {
8080
var up bool
8181
for i := 0; i < 5000; i++ {
82-
if err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc); ErrorDesc(err) == s.port {
82+
if err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc); errorDesc(err) == s.port {
8383
up = true
8484
break
8585
}
@@ -94,7 +94,7 @@ func checkRoundRobin(cc *ClientConn, servers []*server) error {
9494
serverCount := len(servers)
9595
for i := 0; i < 3*serverCount; i++ {
9696
err = Invoke(context.Background(), "/foo/bar", &req, &reply, cc)
97-
if ErrorDesc(err) != servers[i%serverCount].port {
97+
if errorDesc(err) != servers[i%serverCount].port {
9898
return fmt.Errorf("Index %d: want peer %v, got peer %v", i, servers[i%serverCount].port, err)
9999
}
100100
}

balancer_test.go

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434

3535
// V1 balancer tests use passthrough resolver instead of dns.
3636
// TODO(bar) remove this when removing v1 balaner entirely.
37+
"google.golang.org/grpc/internal"
3738
_ "google.golang.org/grpc/resolver/passthrough"
3839
)
3940

@@ -128,7 +129,7 @@ func TestNameDiscovery(t *testing.T) {
128129
defer cc.Close()
129130
req := "port"
130131
var reply string
131-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[0].port {
132+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[0].port {
132133
t.Fatalf("grpc.Invoke(_, _, _, _, _) = %v, want %s", err, servers[0].port)
133134
}
134135
// Inject the name resolution change to remove servers[0] and add servers[1].
@@ -144,7 +145,7 @@ func TestNameDiscovery(t *testing.T) {
144145
r.w.inject(updates)
145146
// Loop until the rpcs in flight talks to servers[1].
146147
for {
147-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[1].port {
148+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[1].port {
148149
break
149150
}
150151
time.Sleep(10 * time.Millisecond)
@@ -204,7 +205,7 @@ func TestRoundRobin(t *testing.T) {
204205
var reply string
205206
// Loop until servers[1] is up
206207
for {
207-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[1].port {
208+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[1].port {
208209
break
209210
}
210211
time.Sleep(10 * time.Millisecond)
@@ -217,14 +218,14 @@ func TestRoundRobin(t *testing.T) {
217218
r.w.inject([]*naming.Update{u})
218219
// Loop until both servers[2] are up.
219220
for {
220-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[2].port {
221+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[2].port {
221222
break
222223
}
223224
time.Sleep(10 * time.Millisecond)
224225
}
225226
// Check the incoming RPCs served in a round-robin manner.
226227
for i := 0; i < 10; i++ {
227-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[i%numServers].port {
228+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[i%numServers].port {
228229
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", i, err, servers[i%numServers].port)
229230
}
230231
}
@@ -252,7 +253,7 @@ func TestCloseWithPendingRPC(t *testing.T) {
252253
// Loop until the above update applies.
253254
for {
254255
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
255-
if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc, FailFast(false)); Code(err) == codes.DeadlineExceeded {
256+
if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc, FailFast(false)); internal.Code(err) == codes.DeadlineExceeded {
256257
cancel()
257258
break
258259
}
@@ -300,7 +301,7 @@ func TestGetOnWaitChannel(t *testing.T) {
300301
for {
301302
var reply string
302303
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
303-
if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc, FailFast(false)); Code(err) == codes.DeadlineExceeded {
304+
if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc, FailFast(false)); internal.Code(err) == codes.DeadlineExceeded {
304305
cancel()
305306
break
306307
}
@@ -348,7 +349,7 @@ func TestOneServerDown(t *testing.T) {
348349
var reply string
349350
// Loop until servers[1] is up
350351
for {
351-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[1].port {
352+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[1].port {
352353
break
353354
}
354355
time.Sleep(10 * time.Millisecond)
@@ -401,7 +402,7 @@ func TestOneAddressRemoval(t *testing.T) {
401402
var reply string
402403
// Loop until servers[1] is up
403404
for {
404-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[1].port {
405+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[1].port {
405406
break
406407
}
407408
time.Sleep(10 * time.Millisecond)
@@ -450,7 +451,7 @@ func checkServerUp(t *testing.T, currentServer *server) {
450451
defer cc.Close()
451452
var reply string
452453
for {
453-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == port {
454+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == port {
454455
break
455456
}
456457
time.Sleep(10 * time.Millisecond)
@@ -511,7 +512,7 @@ func TestPickFirstCloseWithPendingRPC(t *testing.T) {
511512
// Loop until the above update applies.
512513
for {
513514
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
514-
if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc, FailFast(false)); Code(err) == codes.DeadlineExceeded {
515+
if err := Invoke(ctx, "/foo/bar", &expectedRequest, &reply, cc, FailFast(false)); internal.Code(err) == codes.DeadlineExceeded {
515516
cancel()
516517
break
517518
}
@@ -574,7 +575,7 @@ func TestPickFirstOrderAllServerUp(t *testing.T) {
574575
req := "port"
575576
var reply string
576577
for i := 0; i < 20; i++ {
577-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[0].port {
578+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[0].port {
578579
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
579580
}
580581
time.Sleep(10 * time.Millisecond)
@@ -589,13 +590,13 @@ func TestPickFirstOrderAllServerUp(t *testing.T) {
589590
r.w.inject([]*naming.Update{u})
590591
// Loop until it changes to server[1]
591592
for {
592-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[1].port {
593+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[1].port {
593594
break
594595
}
595596
time.Sleep(10 * time.Millisecond)
596597
}
597598
for i := 0; i < 20; i++ {
598-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[1].port {
599+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[1].port {
599600
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
600601
}
601602
time.Sleep(10 * time.Millisecond)
@@ -609,7 +610,7 @@ func TestPickFirstOrderAllServerUp(t *testing.T) {
609610
}
610611
r.w.inject([]*naming.Update{u})
611612
for i := 0; i < 20; i++ {
612-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[1].port {
613+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[1].port {
613614
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
614615
}
615616
time.Sleep(10 * time.Millisecond)
@@ -622,13 +623,13 @@ func TestPickFirstOrderAllServerUp(t *testing.T) {
622623
}
623624
r.w.inject([]*naming.Update{u})
624625
for {
625-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[2].port {
626+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[2].port {
626627
break
627628
}
628629
time.Sleep(1 * time.Second)
629630
}
630631
for i := 0; i < 20; i++ {
631-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[2].port {
632+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[2].port {
632633
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 2, err, servers[2].port)
633634
}
634635
time.Sleep(10 * time.Millisecond)
@@ -641,13 +642,13 @@ func TestPickFirstOrderAllServerUp(t *testing.T) {
641642
}
642643
r.w.inject([]*naming.Update{u})
643644
for {
644-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[0].port {
645+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[0].port {
645646
break
646647
}
647648
time.Sleep(1 * time.Second)
648649
}
649650
for i := 0; i < 20; i++ {
650-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[0].port {
651+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[0].port {
651652
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
652653
}
653654
time.Sleep(10 * time.Millisecond)
@@ -687,7 +688,7 @@ func TestPickFirstOrderOneServerDown(t *testing.T) {
687688
req := "port"
688689
var reply string
689690
for i := 0; i < 20; i++ {
690-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[0].port {
691+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[0].port {
691692
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
692693
}
693694
time.Sleep(10 * time.Millisecond)
@@ -698,13 +699,13 @@ func TestPickFirstOrderOneServerDown(t *testing.T) {
698699
servers[0].stop()
699700
// Loop until it changes to server[1]
700701
for {
701-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[1].port {
702+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[1].port {
702703
break
703704
}
704705
time.Sleep(10 * time.Millisecond)
705706
}
706707
for i := 0; i < 20; i++ {
707-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[1].port {
708+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[1].port {
708709
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
709710
}
710711
time.Sleep(10 * time.Millisecond)
@@ -719,7 +720,7 @@ func TestPickFirstOrderOneServerDown(t *testing.T) {
719720
checkServerUp(t, servers[0])
720721

721722
for i := 0; i < 20; i++ {
722-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[1].port {
723+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[1].port {
723724
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 1, err, servers[1].port)
724725
}
725726
time.Sleep(10 * time.Millisecond)
@@ -732,13 +733,13 @@ func TestPickFirstOrderOneServerDown(t *testing.T) {
732733
}
733734
r.w.inject([]*naming.Update{u})
734735
for {
735-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && ErrorDesc(err) == servers[0].port {
736+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err != nil && errorDesc(err) == servers[0].port {
736737
break
737738
}
738739
time.Sleep(1 * time.Second)
739740
}
740741
for i := 0; i < 20; i++ {
741-
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || ErrorDesc(err) != servers[0].port {
742+
if err := Invoke(context.Background(), "/foo/bar", &req, &reply, cc); err == nil || errorDesc(err) != servers[0].port {
742743
t.Fatalf("Index %d: Invoke(_, _, _, _, _) = %v, want %s", 0, err, servers[0].port)
743744
}
744745
time.Sleep(10 * time.Millisecond)

balancer_v1_wrapper.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"google.golang.org/grpc/connectivity"
2929
"google.golang.org/grpc/grpclog"
3030
"google.golang.org/grpc/resolver"
31+
"google.golang.org/grpc/status"
3132
)
3233

3334
type balancerWrapperBuilder struct {
@@ -317,12 +318,12 @@ func (bw *balancerWrapper) Pick(ctx context.Context, opts balancer.PickOptions)
317318
Metadata: a.Metadata,
318319
}]
319320
if !ok && failfast {
320-
return nil, nil, Errorf(codes.Unavailable, "there is no connection available")
321+
return nil, nil, status.Errorf(codes.Unavailable, "there is no connection available")
321322
}
322323
if s, ok := bw.connSt[sc]; failfast && (!ok || s.s != connectivity.Ready) {
323324
// If the returned sc is not ready and RPC is failfast,
324325
// return error, and this RPC will fail.
325-
return nil, nil, Errorf(codes.Unavailable, "there is no connection available")
326+
return nil, nil, status.Errorf(codes.Unavailable, "there is no connection available")
326327
}
327328
}
328329

0 commit comments

Comments
 (0)