Skip to content

Commit

Permalink
cleanup: Fix usages of non-constant format strings (#7959)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal authored Dec 23, 2024
1 parent 681334a commit e912015
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/testutils/blocking_context_dialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion internal/transport/handler_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
2 changes: 1 addition & 1 deletion stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion test/creds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 2 additions & 2 deletions test/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion xds/internal/balancer/clusterimpl/picker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion xds/internal/xdsclient/transport/ads/ads_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e912015

Please sign in to comment.