Skip to content

Commit 1ef7486

Browse files
authored
[chore]: enable unused-receiver rule from revive (#4786)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent 8a56b9b commit 1ef7486

File tree

27 files changed

+66
-68
lines changed

27 files changed

+66
-68
lines changed

.golangci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ linters:
142142
disabled: true
143143
- name: unused-parameter
144144
disabled: true # FIXME
145-
- name: unused-receiver
146-
disabled: true # FIXME
147145
- name: use-waitgroup-go
148146
disabled: true
149147
- name: var-naming

apis/v1alpha1/instrumentation_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (w InstrumentationWebhook) defaulter(r *Instrumentation) error {
198198
return nil
199199
}
200200

201-
func (w InstrumentationWebhook) validate(r *Instrumentation) (admission.Warnings, error) {
201+
func (InstrumentationWebhook) validate(r *Instrumentation) (admission.Warnings, error) {
202202
var warnings []string
203203
switch r.Spec.Type {
204204
case "":

apis/v1alpha1/opampbridge_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (o *OpAMPBridgeWebhook) ValidateDelete(ctx context.Context, obj runtime.Obj
6666
return o.validate(opampBridge)
6767
}
6868

69-
func (o *OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error {
69+
func (*OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error {
7070
if len(r.Spec.UpgradeStrategy) == 0 {
7171
r.Spec.UpgradeStrategy = UpgradeStrategyAutomatic
7272
}
@@ -90,7 +90,7 @@ func (o *OpAMPBridgeWebhook) defaulter(r *OpAMPBridge) error {
9090
return nil
9191
}
9292

93-
func (o *OpAMPBridgeWebhook) validate(r *OpAMPBridge) (admission.Warnings, error) {
93+
func (*OpAMPBridgeWebhook) validate(r *OpAMPBridge) (admission.Warnings, error) {
9494
warnings := admission.Warnings{}
9595

9696
// validate OpAMP server endpoint

apis/v1alpha1/targetallocator_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (w TargetAllocatorWebhook) ValidateDelete(ctx context.Context, obj runtime.
7070
return w.validate(ctx, otelcol)
7171
}
7272

73-
func (w TargetAllocatorWebhook) defaulter(ta *TargetAllocator) error {
73+
func (TargetAllocatorWebhook) defaulter(ta *TargetAllocator) error {
7474
if ta.Labels == nil {
7575
ta.Labels = map[string]string{}
7676
}

cmd/gather/cluster/cluster_test.go

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

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

87-
func (m *MockClient) IsObjectNamespaced(_ runtime.Object) (bool, error) {
87+
func (*MockClient) IsObjectNamespaced(runtime.Object) (bool, error) {
8888
return true, nil
8989
}
9090

91-
func (m *MockClient) SubResource(string) client.SubResourceClient {
91+
func (*MockClient) SubResource(string) client.SubResourceClient {
9292
return nil
9393
}
9494

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (agent *Agent) generateCollectorPoolHealth() (map[string]*protobufs.Compone
158158
}
159159

160160
// getCollectorSelector destructures the collectors scale selector if present, it uses the labelmap from the operator.
161-
func (agent *Agent) getCollectorSelector(col v1beta1.OpenTelemetryCollector) map[string]string {
161+
func (*Agent) getCollectorSelector(col v1beta1.OpenTelemetryCollector) map[string]string {
162162
if len(col.Status.Scale.Selector) > 0 {
163163
selMap := map[string]string{}
164164
for kvPair := range strings.SplitSeq(col.Status.Scale.Selector, ",") {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ type mockOpampClient struct {
184184
settings types.StartSettings
185185
}
186186

187-
func (m *mockOpampClient) SetCustomCapabilities(_ *protobufs.CustomCapabilities) error {
187+
func (*mockOpampClient) SetCustomCapabilities(*protobufs.CustomCapabilities) error {
188188
return nil
189189
}
190190

191-
func (m *mockOpampClient) SendCustomMessage(_ *protobufs.CustomMessage) (messageSendingChannel chan struct{}, err error) {
191+
func (*mockOpampClient) SendCustomMessage(*protobufs.CustomMessage) (messageSendingChannel chan struct{}, err error) {
192192
return nil, nil
193193
}
194194

195-
func (m *mockOpampClient) RequestConnectionSettings(_ *protobufs.ConnectionSettingsRequest) error {
195+
func (*mockOpampClient) RequestConnectionSettings(*protobufs.ConnectionSettingsRequest) error {
196196
return nil
197197
}
198198

@@ -203,15 +203,15 @@ func (m *mockOpampClient) Start(_ context.Context, settings types.StartSettings)
203203
return nil
204204
}
205205

206-
func (m *mockOpampClient) Stop(_ context.Context) error {
206+
func (*mockOpampClient) Stop(context.Context) error {
207207
return nil
208208
}
209209

210-
func (m *mockOpampClient) SetAgentDescription(_ *protobufs.AgentDescription) error {
210+
func (*mockOpampClient) SetAgentDescription(*protobufs.AgentDescription) error {
211211
return nil
212212
}
213213

214-
func (m *mockOpampClient) AgentDescription() *protobufs.AgentDescription {
214+
func (*mockOpampClient) AgentDescription() *protobufs.AgentDescription {
215215
return nil
216216
}
217217

@@ -240,7 +240,7 @@ func (m *mockOpampClient) SetRemoteConfigStatus(status *protobufs.RemoteConfigSt
240240
return nil
241241
}
242242

243-
func (m *mockOpampClient) SetPackageStatuses(_ *protobufs.PackageStatuses) error {
243+
func (*mockOpampClient) SetPackageStatuses(*protobufs.PackageStatuses) error {
244244
return nil
245245
}
246246

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ func (c *Config) GetAgentScheme() string {
157157
return uri.Scheme
158158
}
159159

160-
func (c *Config) GetAgentType() string {
160+
func (*Config) GetAgentType() string {
161161
return agentType
162162
}
163163

164-
func (c *Config) GetAgentVersion() string {
164+
func (*Config) GetAgentVersion() string {
165165
return agentVersion
166166
}
167167

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (a *Agent) UpdateStatus(newStatus *protobufs.AgentToServer, response *proto
128128
return agentDescrChanged
129129
}
130130

131-
func (a *Agent) calcConnectionSettings(response *protobufs.ServerToAgent) {
131+
func (*Agent) calcConnectionSettings(response *protobufs.ServerToAgent) {
132132
// Here we can use Agent's description to send the appropriate connection
133133
// settings to the Agent.
134134
// In this simple example the connection settings do not depend on the

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,19 @@ func TestGetInstanceId(t *testing.T) {
143143
type mockConnection struct{}
144144

145145
// Connection implements types.Connection.
146-
func (m *mockConnection) Connection() net.Conn {
146+
func (*mockConnection) Connection() net.Conn {
147147
panic("unimplemented")
148148
}
149149

150150
// Disconnect implements types.Connection.
151-
func (m *mockConnection) Disconnect() error {
151+
func (*mockConnection) Disconnect() error {
152152
panic("unimplemented")
153153
}
154154

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

159-
func (m *mockConnection) Close() error {
159+
func (*mockConnection) Close() error {
160160
return nil
161161
}

0 commit comments

Comments
 (0)