diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 8f957f8f2..9f716bcb6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -28,6 +28,6 @@ jobs: check-latest: true - name: golangci-lint - uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2 + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: only-new-issues: true diff --git a/.golangci.yml b/.golangci.yml index 729468711..a510e774c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,15 +1,8 @@ +version: "2" run: - timeout: 10m allow-parallel-runners: true - -issues: - # Maximum issues count per one linter. Set to 0 to disable. Default is 50. - max-issues-per-linter: 0 - - # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. - max-same-issues: 0 linters: - disable-all: true + default: none enable: - asasalint - asciicheck @@ -29,15 +22,11 @@ linters: - gocritic - gocyclo - godox - - gofmt - - gofumpt - goheader - - goimports - gomoddirectives - gomodguard - goprintffuncname - gosec - - gosimple - govet - grouper - importas @@ -57,180 +46,153 @@ linters: - rowserrcheck - sqlclosecheck - staticcheck - - stylecheck - - tenv - testableexamples - - typecheck - unconvert - unparam - unused - usestdlibvars - whitespace - # - containedctx - # - cyclop - # - dupword - # - errorlint - # - exhaustive - # - exhaustruct - # - exportloopref - # - forbidigo - # - forcetypeassert - # - funlen - # - gci - # - gochecknoglobals - # - gochecknoinits - # - gocognit - # - godot - # - goerr113 - # - gomnd - # - interfacebloat - # - ireturn - # - lll - # - maintidx - # - nestif - # - nilerr - # - nilnil - # - nlreturn - # - noctx - # - nonamedreturns - # - paralleltest - # - tagliatelle - # - testpackage - # - thelper - # - tparallel - # - varnamelen - # - wastedassign - # - wrapcheck - # - wsl -linters-settings: - gocyclo: - min-complexity: 40 - godox: - keywords: - - BUG - - FIXME - - HACK - errcheck: - check-type-assertions: true - check-blank: true - gocritic: - enabled-checks: - # Diagnostic - - appendAssign - - argOrder - - badCall - - badCond - - badLock - - badRegexp - - badSorting - - builtinShadowDecl - - caseOrder - - codegenComment - - commentedOutCode - - deferInLoop - - deprecatedComment - - dupArg - - dupBranchBody - - dupCase - - dupSubExpr - - dynamicFmtString - - emptyDecl - - evalOrder - - exitAfterDefer - - externalErrorReassign - - filepathJoin - - flagDeref - - flagName - - mapKey - - nilValReturn - - offBy1 - - regexpPattern - - returnAfterHttpError - - sloppyReassign - - sloppyTypeAssert - - sortSlice - - sprintfQuotedString - - sqlQuery - - syncMapLoadAndDelete - - truncateCmp - - unnecessaryDefer - - weakCond - - # Performance - - appendCombine - - equalFold - - hugeParam - - indexAlloc - - preferDecodeRune - - preferFprint - - preferStringWriter - - preferWriteByte - - rangeExprCopy - - rangeValCopy - - sliceClear - - stringXbytes - - # Style - - assignOp - - boolExprSimplify - - captLocal - - commentFormatting - - commentedOutImport - - defaultCaseOrder - - deferUnlambda - - docStub - - dupImport - - elseif - - emptyFallthrough - - emptyStringTest - - exposedSyncMutex - - hexLiteral - - httpNoBody - - ifElseChain - - methodExprCall - - newDeref - - octalLiteral - - preferFilepathJoin - - redundantSprint - - regexpMust - - regexpSimplify - - ruleguard - - singleCaseSwitch - - sloppyLen - - stringConcatSimplify - - stringsCompare - - switchTrue - - timeExprSimplify - - tooManyResultsChecker - - typeAssertChain - - typeDefFirst - - typeSwitchVar - - underef - - unlabelStmt - - unlambda - - unslice - - valSwap - - whyNoLint - - wrapperFunc - - yodaStyleExpr - - # Opinionated - - builtinShadow - - importShadow - - initClause - - nestingReduce - - paramTypeCombine - - ptrToRefParam - - typeUnparen - - unnamedResult - - unnecessaryBlock - nolintlint: - # Enable to ensure that nolint directives are all used. Default is true. - allow-unused: false - # Exclude following linters from requiring an explanation. Default is []. - allow-no-explanation: [] - # Enable to require an explanation of nonzero length after each nolint directive. Default is false. - # TODO(lint): Enforce explanations for `nolint` directives - require-explanation: false - # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. - require-specific: true + settings: + errcheck: + check-type-assertions: true + check-blank: true + gocritic: + enabled-checks: + - appendAssign + - argOrder + - badCall + - badCond + - badLock + - badRegexp + - badSorting + - builtinShadowDecl + - caseOrder + - codegenComment + - commentedOutCode + - deferInLoop + - deprecatedComment + - dupArg + - dupBranchBody + - dupCase + - dupSubExpr + - dynamicFmtString + - emptyDecl + - evalOrder + - exitAfterDefer + - externalErrorReassign + - filepathJoin + - flagDeref + - flagName + - mapKey + - nilValReturn + - offBy1 + - regexpPattern + - returnAfterHttpError + - sloppyReassign + - sloppyTypeAssert + - sortSlice + - sprintfQuotedString + - sqlQuery + - syncMapLoadAndDelete + - truncateCmp + - unnecessaryDefer + - weakCond + - appendCombine + - equalFold + - hugeParam + - indexAlloc + - preferDecodeRune + - preferFprint + - preferStringWriter + - preferWriteByte + - rangeExprCopy + - rangeValCopy + - sliceClear + - stringXbytes + - assignOp + - boolExprSimplify + - captLocal + - commentFormatting + - commentedOutImport + - defaultCaseOrder + - deferUnlambda + - docStub + - dupImport + - elseif + - emptyFallthrough + - emptyStringTest + - exposedSyncMutex + - hexLiteral + - httpNoBody + - ifElseChain + - methodExprCall + - newDeref + - octalLiteral + - preferFilepathJoin + - redundantSprint + - regexpMust + - regexpSimplify + - ruleguard + - singleCaseSwitch + - sloppyLen + - stringConcatSimplify + - stringsCompare + - switchTrue + - timeExprSimplify + - tooManyResultsChecker + - typeAssertChain + - typeDefFirst + - typeSwitchVar + - underef + - unlabelStmt + - unlambda + - unslice + - valSwap + - whyNoLint + - wrapperFunc + - yodaStyleExpr + - builtinShadow + - importShadow + - initClause + - nestingReduce + - paramTypeCombine + - ptrToRefParam + - typeUnparen + - unnamedResult + - unnecessaryBlock + gocyclo: + min-complexity: 40 + godox: + keywords: + - BUG + - FIXME + - HACK + nolintlint: + require-explanation: false + require-specific: true + allow-unused: false + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +issues: + max-issues-per-linter: 0 + max-same-issues: 0 +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$