Skip to content

Commit 3a4769c

Browse files
authored
[chore]: enable unused-parameter rule from revive (#4790)
1 parent b09dd9a commit 3a4769c

File tree

29 files changed

+55
-57
lines changed

29 files changed

+55
-57
lines changed

.golangci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ linters:
136136
disabled: true # FIXME
137137
- name: unsecure-url-scheme
138138
disabled: true
139-
- name: unused-parameter
140-
disabled: true # FIXME
141139
- name: use-waitgroup-go
142140
disabled: true
143141
- name: var-naming

apis/v1alpha1/instrumentation_webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,31 @@ type InstrumentationWebhook struct {
4646
scheme *runtime.Scheme
4747
}
4848

49-
func (w InstrumentationWebhook) Default(ctx context.Context, obj runtime.Object) error {
49+
func (w InstrumentationWebhook) Default(_ context.Context, obj runtime.Object) error {
5050
instrumentation, ok := obj.(*Instrumentation)
5151
if !ok {
5252
return fmt.Errorf("expected an Instrumentation, received %T", obj)
5353
}
5454
return w.defaulter(instrumentation)
5555
}
5656

57-
func (w InstrumentationWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
57+
func (w InstrumentationWebhook) ValidateCreate(_ context.Context, obj runtime.Object) (admission.Warnings, error) {
5858
inst, ok := obj.(*Instrumentation)
5959
if !ok {
6060
return nil, fmt.Errorf("expected an Instrumentation, received %T", obj)
6161
}
6262
return w.validate(inst)
6363
}
6464

65-
func (w InstrumentationWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
65+
func (w InstrumentationWebhook) ValidateUpdate(_ context.Context, _, newObj runtime.Object) (admission.Warnings, error) {
6666
inst, ok := newObj.(*Instrumentation)
6767
if !ok {
6868
return nil, fmt.Errorf("expected an Instrumentation, received %T", newObj)
6969
}
7070
return w.validate(inst)
7171
}
7272

73-
func (w InstrumentationWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
73+
func (w InstrumentationWebhook) ValidateDelete(_ context.Context, obj runtime.Object) (admission.Warnings, error) {
7474
inst, ok := obj.(*Instrumentation)
7575
if !ok || inst == nil {
7676
return nil, fmt.Errorf("expected an Instrumentation, received %T", obj)

apis/v1alpha1/opampbridge_webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,31 @@ type OpAMPBridgeWebhook struct {
3434
scheme *runtime.Scheme
3535
}
3636

37-
func (o *OpAMPBridgeWebhook) Default(ctx context.Context, obj runtime.Object) error {
37+
func (o *OpAMPBridgeWebhook) Default(_ context.Context, obj runtime.Object) error {
3838
opampBridge, ok := obj.(*OpAMPBridge)
3939
if !ok {
4040
return fmt.Errorf("expected an OpAMPBridge, received %T", obj)
4141
}
4242
return o.defaulter(opampBridge)
4343
}
4444

45-
func (o *OpAMPBridgeWebhook) ValidateCreate(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
45+
func (o *OpAMPBridgeWebhook) ValidateCreate(_ context.Context, obj runtime.Object) (admission.Warnings, error) {
4646
opampBridge, ok := obj.(*OpAMPBridge)
4747
if !ok {
4848
return nil, fmt.Errorf("expected an OpAMPBridge, received %T", obj)
4949
}
5050
return o.validate(opampBridge)
5151
}
5252

53-
func (o *OpAMPBridgeWebhook) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {
53+
func (o *OpAMPBridgeWebhook) ValidateUpdate(_ context.Context, _, newObj runtime.Object) (admission.Warnings, error) {
5454
opampBridge, ok := newObj.(*OpAMPBridge)
5555
if !ok {
5656
return nil, fmt.Errorf("expected an OpAMPBridge, received %T", newObj)
5757
}
5858
return o.validate(opampBridge)
5959
}
6060

61-
func (o *OpAMPBridgeWebhook) ValidateDelete(ctx context.Context, obj runtime.Object) (admission.Warnings, error) {
61+
func (o *OpAMPBridgeWebhook) ValidateDelete(_ context.Context, obj runtime.Object) (admission.Warnings, error) {
6262
opampBridge, ok := obj.(*OpAMPBridge)
6363
if !ok || opampBridge == nil {
6464
return nil, fmt.Errorf("expected an OpAMPBridge, received %T", obj)

cmd/gather/cluster/cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (m *MockClient) RESTMapper() meta.RESTMapper {
8080
return args.Get(0).(meta.RESTMapper)
8181
}
8282

83-
func (*MockClient) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error) {
83+
func (*MockClient) GroupVersionKindFor(runtime.Object) (schema.GroupVersionKind, error) {
8484
return schema.GroupVersionKind{}, nil
8585
}
8686

cmd/operator-opamp-bridge/internal/agent/agent.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,17 @@ func (agent *Agent) generateCollectorHealth(selectorLabels map[string]string, na
216216
}
217217

218218
// onConnect is called when an agent is successfully connected to a server.
219-
func (agent *Agent) onConnect(ctx context.Context) {
219+
func (agent *Agent) onConnect(context.Context) {
220220
agent.logger.V(3).Info("Connected to the server.")
221221
}
222222

223223
// onConnectFailed is called when an agent was unable to connect to a server.
224-
func (agent *Agent) onConnectFailed(ctx context.Context, err error) {
224+
func (agent *Agent) onConnectFailed(_ context.Context, err error) {
225225
agent.logger.Error(err, "failed to connect to the server")
226226
}
227227

228228
// onError is called when an agent receives an error response from the server.
229-
func (agent *Agent) onError(ctx context.Context, err *protobufs.ServerErrorResponse) {
229+
func (agent *Agent) onError(_ context.Context, err *protobufs.ServerErrorResponse) {
230230
agent.logger.Error(errors.New(err.GetErrorMessage()), "server returned an error response")
231231
}
232232

@@ -340,7 +340,7 @@ func (agent *Agent) updateAgentIdentity(instanceId uuid.UUID) {
340340

341341
// getEffectiveConfig is called when a remote server needs to learn of the current effective configuration of each
342342
// collector the agent is managing.
343-
func (agent *Agent) getEffectiveConfig(ctx context.Context) (*protobufs.EffectiveConfig, error) {
343+
func (agent *Agent) getEffectiveConfig(context.Context) (*protobufs.EffectiveConfig, error) {
344344
instances, err := agent.applier.ListInstances()
345345
if err != nil {
346346
agent.logger.Error(err, "failed to list instances")

cmd/operator-opamp-bridge/internal/logger/logger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ func NewLogger(logger logr.Logger) *Logger {
2121
return &Logger{Logger: logger}
2222
}
2323

24-
func (l *Logger) Debugf(ctx context.Context, format string, v ...any) {
24+
func (l *Logger) Debugf(_ context.Context, format string, v ...any) {
2525
l.Logger.V(4).Info(fmt.Sprintf(format, v...))
2626
}
2727

28-
func (l *Logger) Errorf(ctx context.Context, format string, v ...any) {
28+
func (l *Logger) Errorf(_ context.Context, format string, v ...any) {
2929
l.Logger.V(0).Error(nil, fmt.Sprintf(format, v...))
3030
}

cmd/operator-opamp-bridge/internal/proxy/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (s *OpAMPProxy) Start() error {
6868
Settings: server.Settings{
6969
CustomCapabilities: []string{},
7070
Callbacks: server.CallbacksStruct{
71-
OnConnectingFunc: func(request *http.Request) types.ConnectionResponse {
71+
OnConnectingFunc: func(*http.Request) types.ConnectionResponse {
7272
return types.ConnectionResponse{
7373
Accept: true,
7474
ConnectionCallbacks: server.ConnectionCallbacksStruct{
@@ -115,7 +115,7 @@ func (s *OpAMPProxy) onDisconnect(conn types.Connection) {
115115
s.updatesChan <- struct{}{}
116116
}
117117

118-
func (s *OpAMPProxy) onMessage(ctx context.Context, conn types.Connection, msg *protobufs.AgentToServer) *protobufs.ServerToAgent {
118+
func (s *OpAMPProxy) onMessage(_ context.Context, conn types.Connection, msg *protobufs.AgentToServer) *protobufs.ServerToAgent {
119119
// Start building the response.
120120
response := &protobufs.ServerToAgent{}
121121

cmd/operator-opamp-bridge/internal/proxy/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (*mockConnection) Disconnect() error {
152152
panic("unimplemented")
153153
}
154154

155-
func (*mockConnection) Send(ctx context.Context, msg *protobufs.ServerToAgent) error {
155+
func (*mockConnection) Send(context.Context, *protobufs.ServerToAgent) error {
156156
return nil
157157
}
158158

cmd/otel-allocator/internal/allocation/consistent_hashing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ func (s *consistentHashingStrategy) SetCollectors(collectors map[string]*Collect
7272
s.consistentHasher = consistent.New(members, s.config)
7373
}
7474

75-
func (*consistentHashingStrategy) SetFallbackStrategy(fallbackStrategy Strategy) {}
75+
func (*consistentHashingStrategy) SetFallbackStrategy(Strategy) {}

cmd/otel-allocator/internal/allocation/least_weighted.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ func (*leastWeightedStrategy) GetCollectorForTarget(collectors map[string]*Colle
5555

5656
func (*leastWeightedStrategy) SetCollectors(map[string]*Collector) {}
5757

58-
func (*leastWeightedStrategy) SetFallbackStrategy(fallbackStrategy Strategy) {}
58+
func (*leastWeightedStrategy) SetFallbackStrategy(Strategy) {}

0 commit comments

Comments
 (0)