From 15de13f9d2644a99d029fdb43070acff873599e4 Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Mon, 31 Mar 2025 11:37:40 +0200 Subject: [PATCH] Fix linting issue and temporary removing logging in test acion Signed-off-by: Benoit Tigeot --- internal/log/logger.go | 6 +++--- internal/log/slog.go | 2 +- pkg/action/action_test.go | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/log/logger.go b/internal/log/logger.go index ff971bdb1..10351d476 100644 --- a/internal/log/logger.go +++ b/internal/log/logger.go @@ -33,13 +33,13 @@ type Logger interface { type NopLogger struct{} // Debug implements Logger.Debug by doing nothing. -func (NopLogger) Debug(_ string, args ...any) {} +func (NopLogger) Debug(_ string, _ ...any) {} // Warn implements Logger.Warn by doing nothing. -func (NopLogger) Warn(_ string, args ...any) {} +func (NopLogger) Warn(_ string, _ ...any) {} // Error implements Logger.Error by doing nothing. -func (NopLogger) Error(_ string, args ...any) {} +func (NopLogger) Error(_ string, _ ...any) {} // DefaultLogger provides a no-op logger that discards all messages. // It can be used as a default when no logger is provided. diff --git a/internal/log/slog.go b/internal/log/slog.go index 7765545f9..1cafd49b1 100644 --- a/internal/log/slog.go +++ b/internal/log/slog.go @@ -59,7 +59,7 @@ func NewReadableTextLogger(output io.Writer, debugEnabled bool) Logger { handler := slog.NewTextHandler(output, &slog.HandlerOptions{ Level: level, - ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr { + ReplaceAttr: func(_ []string, a slog.Attr) slog.Attr { if a.Key == slog.TimeKey { return slog.Attr{} } diff --git a/pkg/action/action_test.go b/pkg/action/action_test.go index efaebb3f9..746a7e54b 100644 --- a/pkg/action/action_test.go +++ b/pkg/action/action_test.go @@ -16,7 +16,6 @@ limitations under the License. package action import ( - "flag" "fmt" "io" "testing" @@ -35,8 +34,6 @@ import ( "helm.sh/helm/v4/pkg/time" ) -var verbose = flag.Bool("test.log", false, "enable test logging") - func actionConfigFixture(t *testing.T) *Configuration { t.Helper() @@ -50,7 +47,7 @@ func actionConfigFixture(t *testing.T) *Configuration { KubeClient: &kubefake.FailingKubeClient{PrintingKubeClient: kubefake.PrintingKubeClient{Out: io.Discard}}, Capabilities: chartutil.DefaultCapabilities, RegistryClient: registryClient, - Log: logadapter.DefaultLogger, + Log: logadapter.DefaultLogger, // TODO: permit to log in test as before with `var verbose = flag.Bool("test.log", false, "enable test logging")`` } }