diff --git a/internal/testutils/blocking_context_dialer_test.go b/internal/testutils/blocking_context_dialer_test.go index eb5d418d4baf..b826c5a91be5 100644 --- a/internal/testutils/blocking_context_dialer_test.go +++ b/internal/testutils/blocking_context_dialer_test.go @@ -125,7 +125,7 @@ func (s) TestBlockingDialer_HoldWaitFail(t *testing.T) { }() if !h.Wait(ctx) { - t.Fatalf("Timeout while waiting for a connection attempt to " + h.addr) + t.Fatal("Timeout while waiting for a connection attempt to " + h.addr) } select { case err = <-dialError: diff --git a/internal/transport/handler_server.go b/internal/transport/handler_server.go index d9305a65d88f..3dea23573518 100644 --- a/internal/transport/handler_server.go +++ b/internal/transport/handler_server.go @@ -498,5 +498,5 @@ func mapRecvMsgError(err error) error { if strings.Contains(err.Error(), "body closed by handler") { return status.Error(codes.Canceled, err.Error()) } - return connectionErrorf(true, err, err.Error()) + return connectionErrorf(true, err, "%s", err.Error()) } diff --git a/stream.go b/stream.go index 17e2267b3320..54adbbced7a6 100644 --- a/stream.go +++ b/stream.go @@ -1766,7 +1766,7 @@ func (ss *serverStream) RecvMsg(m any) (err error) { return err } if err == io.ErrUnexpectedEOF { - err = status.Errorf(codes.Internal, io.ErrUnexpectedEOF.Error()) + err = status.Error(codes.Internal, io.ErrUnexpectedEOF.Error()) } return toRPCErr(err) } diff --git a/test/creds_test.go b/test/creds_test.go index fe8b552e719c..bedafa5b7272 100644 --- a/test/creds_test.go +++ b/test/creds_test.go @@ -186,7 +186,7 @@ type methodTestCreds struct{} func (m *methodTestCreds) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error) { ri, _ := credentials.RequestInfoFromContext(ctx) - return nil, status.Errorf(codes.Unknown, ri.Method) + return nil, status.Error(codes.Unknown, ri.Method) } func (m *methodTestCreds) RequireTransportSecurity() bool { return false } diff --git a/test/end2end_test.go b/test/end2end_test.go index 19972ecebe17..548bd68b4e9c 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -4692,7 +4692,7 @@ func (s) TestTapTimeout(t *testing.T) { ss := &stubserver.StubServer{ EmptyCallF: func(ctx context.Context, _ *testpb.Empty) (*testpb.Empty, error) { <-ctx.Done() - return nil, status.Errorf(codes.Canceled, ctx.Err().Error()) + return nil, status.Error(codes.Canceled, ctx.Err().Error()) }, } if err := ss.Start(sopts); err != nil { @@ -5104,7 +5104,7 @@ func (s) TestStatusInvalidUTF8Message(t *testing.T) { ss := &stubserver.StubServer{ EmptyCallF: func(context.Context, *testpb.Empty) (*testpb.Empty, error) { - return nil, status.Errorf(codes.Internal, origMsg) + return nil, status.Error(codes.Internal, origMsg) }, } if err := ss.Start(nil); err != nil { diff --git a/xds/internal/balancer/clusterimpl/picker.go b/xds/internal/balancer/clusterimpl/picker.go index dd4d39b3d398..cd94182fa717 100644 --- a/xds/internal/balancer/clusterimpl/picker.go +++ b/xds/internal/balancer/clusterimpl/picker.go @@ -129,7 +129,7 @@ func (d *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { if d.loadStore != nil { d.loadStore.CallDropped("") } - return balancer.PickResult{}, status.Errorf(codes.Unavailable, err.Error()) + return balancer.PickResult{}, status.Error(codes.Unavailable, err.Error()) } } diff --git a/xds/internal/xdsclient/transport/ads/ads_stream.go b/xds/internal/xdsclient/transport/ads/ads_stream.go index 4c4856a07347..bf7510058c5f 100644 --- a/xds/internal/xdsclient/transport/ads/ads_stream.go +++ b/xds/internal/xdsclient/transport/ads/ads_stream.go @@ -664,7 +664,7 @@ func (s *StreamImpl) onError(err error, msgReceived bool) { // connection hitting its max connection age limit. // (see [gRFC A9](https://github.com/grpc/proposal/blob/master/A9-server-side-conn-mgt.md)). if msgReceived { - err = xdsresource.NewErrorf(xdsresource.ErrTypeStreamFailedAfterRecv, err.Error()) + err = xdsresource.NewErrorf(xdsresource.ErrTypeStreamFailedAfterRecv, "%s", err.Error()) } s.eventHandler.OnADSStreamError(err)