Skip to content

Commit 67080e8

Browse files
mmorel-35MrAlias
andauthored
chore: enable unused-parameter and unused-receiver rules from revive (#7645)
Signed-off-by: Matthieu MOREL <[email protected]> Co-authored-by: Tyler Yahn <[email protected]>
1 parent 31a4771 commit 67080e8

File tree

86 files changed

+272
-270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+272
-270
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ linters:
135135
- name: time-equal
136136
- name: unconditional-recursion
137137
- name: unexported-return
138+
- name: unused-parameter
139+
- name: unused-receiver
138140
- name: unhandled-error
139141
arguments:
140142
- "fmt.Fprint"

bridges/otellogr/logsink.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func (l *LogSink) Info(level int, msg string, keysAndValues ...any) {
254254

255255
// Init receives optional information about the logr library this
256256
// implementation does not use it.
257-
func (l *LogSink) Init(logr.RuntimeInfo) {
257+
func (*LogSink) Init(logr.RuntimeInfo) {
258258
// We don't need to do anything here.
259259
// CallDepth is used to calculate the caller's PC.
260260
// PC is dropped as part of the conversion to the OpenTelemetry log.Record.

bridges/otellogr/logsink_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type mockLoggerProvider struct {
2222
embedded.LoggerProvider
2323
}
2424

25-
func (mockLoggerProvider) Logger(name string, options ...log.LoggerOption) log.Logger {
25+
func (mockLoggerProvider) Logger(string, ...log.LoggerOption) log.Logger {
2626
return nil
2727
}
2828

@@ -127,7 +127,7 @@ func TestLogSink(t *testing.T) {
127127
}{
128128
{
129129
name: "no_log",
130-
f: func(l *logr.Logger) {},
130+
f: func(*logr.Logger) {},
131131
want: logtest.Recording{
132132
logtest.Scope{Name: name}: nil,
133133
},
@@ -421,7 +421,7 @@ func TestLogSinkContext(t *testing.T) {
421421
}
422422

423423
func TestLogSinkEnabled(t *testing.T) {
424-
enabledFunc := func(ctx context.Context, param log.EnabledParameters) bool {
424+
enabledFunc := func(_ context.Context, param log.EnabledParameters) bool {
425425
return param.Severity == log.SeverityInfo
426426
}
427427

bridges/otellogrus/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (h *Hook) Fire(entry *logrus.Entry) error {
171171
return nil
172172
}
173173

174-
func (h *Hook) convertEntry(e *logrus.Entry) log.Record {
174+
func (*Hook) convertEntry(e *logrus.Entry) log.Record {
175175
var record log.Record
176176
record.SetTimestamp(e.Time)
177177
record.SetBody(log.StringValue(e.Message))

bridges/otellogrus/hook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type mockLoggerProvider struct {
2121
embedded.LoggerProvider
2222
}
2323

24-
func (mockLoggerProvider) Logger(name string, options ...log.LoggerOption) log.Logger {
24+
func (mockLoggerProvider) Logger(string, ...log.LoggerOption) log.Logger {
2525
return nil
2626
}
2727

bridges/otelslog/handler_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ func TestSLogHandler(t *testing.T) {
453453

454454
func TestSlogtest(t *testing.T) {
455455
r := new(recorder)
456-
slogtest.Run(t, func(t *testing.T) slog.Handler {
456+
slogtest.Run(t, func(*testing.T) slog.Handler {
457457
r = new(recorder)
458458
return NewHandler("", WithLoggerProvider(r))
459-
}, func(t *testing.T) map[string]any {
459+
}, func(*testing.T) map[string]any {
460460
return r.Results()[0]
461461
})
462462
}

bridges/otelzap/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (o *Core) clone() *Core {
183183
}
184184

185185
// Sync flushes buffered logs (if any).
186-
func (o *Core) Sync() error {
186+
func (*Core) Sync() error {
187187
return nil
188188
}
189189

bridges/otelzap/core_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func TestCoreWriteContextConcurrentSafe(t *testing.T) {
225225
}
226226

227227
func TestCoreEnabled(t *testing.T) {
228-
enabledFunc := func(c context.Context, param log.EnabledParameters) bool {
228+
enabledFunc := func(_ context.Context, param log.EnabledParameters) bool {
229229
return param.Severity >= log.SeverityInfo
230230
}
231231

bridges/otelzap/encoder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func TestArrayEncoder(t *testing.T) {
342342

343343
type turducken struct{}
344344

345-
func (t turducken) MarshalLogObject(enc zapcore.ObjectEncoder) error {
345+
func (turducken) MarshalLogObject(enc zapcore.ObjectEncoder) error {
346346
return enc.AddArray("ducks", zapcore.ArrayMarshalerFunc(func(arr zapcore.ArrayEncoder) error {
347347
for i := 0; i < 2; i++ {
348348
err := arr.AppendObject(zapcore.ObjectMarshalerFunc(func(inner zapcore.ObjectEncoder) error {

detectors/autodetect/autodetect_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func testFactory() func() resource.Detector {
2424
return func() resource.Detector { return &testDetector{} }
2525
}
2626

27-
func (d *testDetector) Detect(ctx context.Context) (*resource.Resource, error) {
27+
func (d *testDetector) Detect(context.Context) (*resource.Resource, error) {
2828
return resource.NewWithAttributes(d.schemaURL, d.attr...), d.err
2929
}
3030

0 commit comments

Comments
 (0)