.*: fix revive lint issues `unused-parameter` (#7580)

This commit is contained in:
janardhanvissa 2024-09-03 16:32:50 +00:00 committed by GitHub
parent 6147c81cd0
commit 0f03c747b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 14 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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)

View File

@ -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{}