diff options
author | Patrick Steinhardt <ps@pks.im> | 2023-08-18 09:25:56 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-08-18 11:21:26 +0300 |
commit | 74dda50d3c052e952de07e9ae1775dbfc98fccfc (patch) | |
tree | 9fc4101aa61e5cbbfa955f1135357adf5ed219f7 | |
parent | 7d71af0efe6e8e4b3c7a03bb63adfd011140887d (diff) |
golangci-lint: Disallow use of logrus' `With` functions
The `With` functions provided by logrus use the standard logger provided
by the logrus package. It is discouraged to use it though in favor of
either `internal/log.Default()` or the logger that is part of the RPC
context.
Disallow the use of those functions via golangci-lint's forbidigo
linter.
-rw-r--r-- | .golangci.yml | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/.golangci.yml b/.golangci.yml index d25c2d8f5..db6e94145 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -76,6 +76,8 @@ linters-settings: msg: Use the logger provided by `log.Default()` or `ctxlogrus.Extract()`. - p: ^logrus\.New$ msg: Use the logger provided by `log.Default()` or `ctxlogrus.Extract()`. + - p: ^logrus\.With(Context|Error|Field|Fields|Time)$ + msg: Use the logger provided by `log.Default()` or `ctxlogrus.Extract()`. analyze-types: true paralleltest: # Ignore missing calls to `t.Parallel()` and only report incorrect uses of it. |