diff --git a/credentials/alts/alts_test.go b/credentials/alts/alts_test.go index a0ded43df..6c083a2fe 100644 --- a/credentials/alts/alts_test.go +++ b/credentials/alts/alts_test.go @@ -467,7 +467,7 @@ type testServer struct { testgrpc.UnimplementedTestServiceServer } -func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { +func (s *testServer) UnaryCall(_ context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{ Payload: &testpb.Payload{}, }, nil diff --git a/examples/features/unix_abstract/server/main.go b/examples/features/unix_abstract/server/main.go index 7013466b4..19b15dbab 100644 --- a/examples/features/unix_abstract/server/main.go +++ b/examples/features/unix_abstract/server/main.go @@ -44,7 +44,7 @@ type ecServer struct { addr string } -func (s *ecServer) UnaryEcho(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { +func (s *ecServer) UnaryEcho(_ context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) { return &pb.EchoResponse{Message: fmt.Sprintf("%s (from %s)", req.Message, s.addr)}, nil } diff --git a/gcp/observability/logging_test.go b/gcp/observability/logging_test.go index efabfe056..78af38ecb 100644 --- a/gcp/observability/logging_test.go +++ b/gcp/observability/logging_test.go @@ -589,7 +589,7 @@ func (s) TestBothClientAndServerRPCEvents(t *testing.T) { defer cleanup() ss := &stubserver.StubServer{ - UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + UnaryCallF: func(_ context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{}, nil }, FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error { @@ -650,7 +650,7 @@ func (s) TestClientRPCEventsTruncateHeaderAndMetadata(t *testing.T) { newLoggingExporter = ne }(newLoggingExporter) - newLoggingExporter = func(ctx context.Context, config *config) (loggingExporter, error) { + newLoggingExporter = func(_ context.Context, _ *config) (loggingExporter, error) { return fle, nil } @@ -673,7 +673,7 @@ func (s) TestClientRPCEventsTruncateHeaderAndMetadata(t *testing.T) { defer cleanup() ss := &stubserver.StubServer{ - UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + UnaryCallF: func(_ context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{}, nil }, } @@ -787,7 +787,7 @@ func (s) TestPrecedenceOrderingInConfiguration(t *testing.T) { newLoggingExporter = ne }(newLoggingExporter) - newLoggingExporter = func(ctx context.Context, config *config) (loggingExporter, error) { + newLoggingExporter = func(_ context.Context, _ *config) (loggingExporter, error) { return fle, nil } @@ -822,10 +822,10 @@ func (s) TestPrecedenceOrderingInConfiguration(t *testing.T) { defer cleanup() ss := &stubserver.StubServer{ - EmptyCallF: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) { + EmptyCallF: func(_ context.Context, _ *testpb.Empty) (*testpb.Empty, error) { return &testpb.Empty{}, nil }, - UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + UnaryCallF: func(_ context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{}, nil }, FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error { @@ -1125,7 +1125,7 @@ func (s) TestMetadataTruncationAccountsKey(t *testing.T) { newLoggingExporter = ne }(newLoggingExporter) - newLoggingExporter = func(ctx context.Context, config *config) (loggingExporter, error) { + newLoggingExporter = func(_ context.Context, _ *config) (loggingExporter, error) { return fle, nil } @@ -1149,7 +1149,7 @@ func (s) TestMetadataTruncationAccountsKey(t *testing.T) { defer cleanup() ss := &stubserver.StubServer{ - UnaryCallF: func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + UnaryCallF: func(_ context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{}, nil }, } @@ -1240,6 +1240,7 @@ func (s) TestMetadataTruncationAccountsKey(t *testing.T) { // TestMethodInConfiguration tests different method names with an expectation on // whether they should error or not. func (s) TestMethodInConfiguration(t *testing.T) { + // To skip creating a stackdriver exporter. fle := &fakeLoggingExporter{ t: t, @@ -1249,7 +1250,7 @@ func (s) TestMethodInConfiguration(t *testing.T) { newLoggingExporter = ne }(newLoggingExporter) - newLoggingExporter = func(ctx context.Context, config *config) (loggingExporter, error) { + newLoggingExporter = func(_ context.Context, _ *config) (loggingExporter, error) { return fle, nil } diff --git a/interop/grpclb_fallback/client_linux.go b/interop/grpclb_fallback/client_linux.go index f8a1ac37b..949818249 100644 --- a/interop/grpclb_fallback/client_linux.go +++ b/interop/grpclb_fallback/client_linux.go @@ -75,7 +75,7 @@ func doRPCAndGetPath(client testgrpc.TestServiceClient, timeout time.Duration) t } func dialTCPUserTimeout(ctx context.Context, addr string) (net.Conn, error) { - control := func(network, address string, c syscall.RawConn) error { + control := func(_, _ string, c syscall.RawConn) error { var syscallErr error controlErr := c.Control(func(fd uintptr) { syscallErr = syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, 20000) diff --git a/xds/internal/balancer/clusterimpl/clusterimpl.go b/xds/internal/balancer/clusterimpl/clusterimpl.go index c8017c7ed..0dc71dfed 100644 --- a/xds/internal/balancer/clusterimpl/clusterimpl.go +++ b/xds/internal/balancer/clusterimpl/clusterimpl.go @@ -275,7 +275,7 @@ func (b *clusterImplBalancer) ResolverError(err error) { }) } -func (b *clusterImplBalancer) updateSubConnState(sc balancer.SubConn, s balancer.SubConnState, cb func(balancer.SubConnState)) { +func (b *clusterImplBalancer) updateSubConnState(_ balancer.SubConn, s balancer.SubConnState, cb func(balancer.SubConnState)) { // Trigger re-resolution when a SubConn turns transient failure. This is // necessary for the LogicalDNS in cluster_resolver policy to re-resolve. // @@ -297,7 +297,7 @@ func (b *clusterImplBalancer) UpdateSubConnState(sc balancer.SubConn, s balancer } func (b *clusterImplBalancer) Close() { - b.serializer.TrySchedule(func(ctx context.Context) { + b.serializer.TrySchedule(func(_ context.Context) { b.child.Close() b.childState = balancer.State{}