From 5f15ebd96754bb0715a751fe7ea689706f86fad6 Mon Sep 17 00:00:00 2001 From: 0x1d Date: Wed, 5 Nov 2025 13:27:55 +0100 Subject: [PATCH] fix: add missing comments to noOpLogger methods and remove deprecated output.format - Add comments to all noOpLogger methods to satisfy revive exported rule - Remove deprecated output.format option (use default format instead) This fixes the linting issues: - exported: exported method noOpLogger.* should have comment or be unexported - warning about deprecated output.format option --- .golangci.yml | 1 - pkg/logger/global.go | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b755b1d..ea516cf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -47,6 +47,5 @@ issues: - revive output: - format: colored-line-number print-issued-lines: true print-linter-name: true diff --git a/pkg/logger/global.go b/pkg/logger/global.go index 5f100a2..a039fcc 100644 --- a/pkg/logger/global.go +++ b/pkg/logger/global.go @@ -52,9 +52,20 @@ func ErrorLog(msg string, fields ...Field) { // Used as a fallback when no global logger is set. type noOpLogger struct{} -func (n *noOpLogger) Debug(_ string, _ ...Field) {} -func (n *noOpLogger) Info(_ string, _ ...Field) {} -func (n *noOpLogger) Warn(_ string, _ ...Field) {} -func (n *noOpLogger) Error(_ string, _ ...Field) {} -func (n *noOpLogger) With(_ ...Field) Logger { return n } +// Debug implements Logger.Debug as a no-op. +func (n *noOpLogger) Debug(_ string, _ ...Field) {} + +// Info implements Logger.Info as a no-op. +func (n *noOpLogger) Info(_ string, _ ...Field) {} + +// Warn implements Logger.Warn as a no-op. +func (n *noOpLogger) Warn(_ string, _ ...Field) {} + +// Error implements Logger.Error as a no-op. +func (n *noOpLogger) Error(_ string, _ ...Field) {} + +// With implements Logger.With as a no-op. +func (n *noOpLogger) With(_ ...Field) Logger { return n } + +// WithContext implements Logger.WithContext as a no-op. func (n *noOpLogger) WithContext(_ context.Context) Logger { return n }