From 1143a50da34bb67fddd6770b9bdaf1cd3cec19ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=BBak?= Date: Fri, 3 Dec 2021 18:50:51 +0100 Subject: [PATCH] chore: Forbids "log" package only for aggregators, inputs, outputs, parsers and processors (#10191) Co-authored-by: Pawel Zak --- .golangci.yml | 5 +++++ plugins/common/logrus/hook.go | 2 +- plugins/common/shim/config.go | 2 +- plugins/common/shim/logger.go | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a4d14ddd8..ddd7a0228 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -126,5 +126,10 @@ issues: - path: _test\.go text: "parameter.*seems to be a control flag, avoid control coupling" + - path: (^agent/|^cmd/|^config/|^filter/|^internal/|^logger/|^metric/|^models/|^selfstat/|^testutil/|^plugins/serializers/) + text: "imports-blacklist: should not use the following blacklisted import: \"log\"" + linters: + - revive + output: format: tab diff --git a/plugins/common/logrus/hook.go b/plugins/common/logrus/hook.go index 7596fbbed..84aae8fe8 100644 --- a/plugins/common/logrus/hook.go +++ b/plugins/common/logrus/hook.go @@ -2,7 +2,7 @@ package logrus import ( "io" - "log" + "log" //nolint:revive // Allow exceptional but valid use of log here. "strings" "sync" diff --git a/plugins/common/shim/config.go b/plugins/common/shim/config.go index 089c2b7ee..ad08e08ea 100644 --- a/plugins/common/shim/config.go +++ b/plugins/common/shim/config.go @@ -3,7 +3,7 @@ package shim import ( "errors" "fmt" - "log" + "log" //nolint:revive // Allow exceptional but valid use of log here. "os" "github.com/BurntSushi/toml" diff --git a/plugins/common/shim/logger.go b/plugins/common/shim/logger.go index 3a6dcb086..74bfbfdef 100644 --- a/plugins/common/shim/logger.go +++ b/plugins/common/shim/logger.go @@ -2,7 +2,7 @@ package shim import ( "fmt" - "log" + "log" //nolint:revive // Allow exceptional but valid use of log here. "os" "reflect"