Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Fix usages of non-constant format strings #7959

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
return err
}
if err == io.ErrUnexpectedEOF {
err = status.Errorf(codes.Internal, io.ErrUnexpectedEOF.Error())
err = status.Error(codes.Internal, io.ErrUnexpectedEOF.Error())

Check warning on line 1769 in stream.go

View check run for this annotation

Codecov / codecov/patch

stream.go#L1769

Added line #L1769 was not covered by tests
}
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
Loading