From 64075850fcd181f9142bf4cb0366814540b48e44 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Mon, 26 May 2025 20:48:36 +0200 Subject: [PATCH] fix go-critic linter Signed-off-by: Matthieu MOREL --- .golangci.yml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 5574357641..3c79a25c8c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,6 +27,7 @@ linters: - fatcontext # Detects nested contexts in loops and function literals. - forbidigo - gocheckcompilerdirectives # Detects invalid go compiler directive comments (//go:). + - gocritic # Detects for bugs, performance and style issues. - gosec # Detects security problems. - govet - iface # Detects incorrect use of interfaces. Currently only used for "identical" interfaces in the same package. @@ -103,6 +104,66 @@ linters: msg: Add a wrapper to nlwrap.Handle for EINTR handling and update the list in .golangci.yml. analyze-types: true + gocritic: + disabled-checks: + - appendAssign + - appendCombine + - assignOp + - badCall + - badLock + - boolExprSimplify + - builtinShadow + - builtinShadowDecl + - captLocal + - commentedOutCode + - deferInLoop + - deprecatedComment + - dupImport + - elseif + - emptyFallthrough + - emptyStringTest + - equalFold + - evalOrder + - exitAfterDefer + - exposedSyncMutex + - filepathJoin + - hexLiteral + - httpNoBody + - hugeParam + - ifElseChain + - importShadow + - indexAlloc + - initClause + - mapKey + - methodExprCall + - nestingReduce + - nilValReturn + - octalLiteral + - paramTypeCombine + - preferStringWriter + - ptrToRefParam + - rangeValCopy + - redundantSprint + - regexpMust + - regexpSimplify + - singleCaseSwitch + - sloppyReassign + - sprintfQuotedString + - stringsCompare + - stringConcatSimplify + - stringXbytes + - typeAssertChain + - typeDefFirst + - typeUnparen + - uncheckedInlineErr + - unlambda + - unnamedResult + - unnecessaryDefer + - unslice + - valSwap + - whyNoLint + - yodaStyleExpr + enable-all: true gosec: excludes: - G104 # G104: Errors unhandled; (TODO: reduce unhandled errors, or explicitly ignore)