Skip to content

Commit

Permalink
build: fix some linter warnings
Browse files Browse the repository at this point in the history
revive in golangci-lint has version v1.56.2 complains about unused named
parameters. Sometimes names are useful to document the purpose of a
parameter. Comments are used instead now in those cases.
  • Loading branch information
pohly committed Mar 11, 2024
1 parent 007e661 commit ff7c070
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contextual_slog_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func ExampleSetSlogLogger() {
defer state.Restore()

handler := slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
ReplaceAttr: func(_ /* groups */ []string, a slog.Attr) slog.Attr {
if a.Key == slog.TimeKey {
// Avoid non-deterministic output.
return slog.Attr{}
Expand Down
2 changes: 1 addition & 1 deletion klogr/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func TestKlogrOutput(t *testing.T) {
test.InitKlog(t)
test.Output(t, test.OutputConfig{
NewLogger: func(out io.Writer, v int, vmodule string) logr.Logger {
NewLogger: func(_ io.Writer, _ int, _ string) logr.Logger {
return klogr.NewWithOptions(klogr.WithFormat(klogr.FormatKlog))
},
})
Expand Down
2 changes: 1 addition & 1 deletion output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func BenchmarkKlogOutput(b *testing.B) {

// klogKlogrConfig tests klogr output via klog, using the klog/v2 klogr.
var klogKLogrConfig = test.OutputConfig{
NewLogger: func(out io.Writer, v int, vmodule string) logr.Logger {
NewLogger: func(_ io.Writer, _ int, _ string) logr.Logger {
return klog.NewKlogr()
},
}
Expand Down
2 changes: 1 addition & 1 deletion test/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func Output(t *testing.T, config OutputConfig) {

if config.NewLogger == nil {
// Test klog.
testOutput(t, printWithKlogLine-1, func(buffer *bytes.Buffer) {
testOutput(t, printWithKlogLine-1, func(_ *bytes.Buffer) {
printWithKlog(test)
})
return
Expand Down
2 changes: 1 addition & 1 deletion textlogger/textlogger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func ExampleBacktrace() {
backtraceCounter := 0
config := textlogger.NewConfig(
textlogger.FixedTime(ts), // To get consistent output for each run.
textlogger.Backtrace(func(skip int) (filename string, line int) {
textlogger.Backtrace(func(_ /* skip */ int) (filename string, line int) {
backtraceCounter++
if backtraceCounter == 1 {
// Simulate "missing information".
Expand Down

0 comments on commit ff7c070

Please sign in to comment.