From bb6f509923fe0bbd7e8daa04eab06f3844958445 Mon Sep 17 00:00:00 2001 From: mixalight Date: Tue, 5 Dec 2023 16:33:32 +0300 Subject: [PATCH 1/5] Change golangci to enable all --- .golangci.yml | 79 +++++++++++++-------------------------------------- 1 file changed, 20 insertions(+), 59 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index efaf32e7e..955af06d6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -225,66 +225,27 @@ linters-settings: # Default: false checkExported: true linters: - disable-all: true - enable: -# - cyclop + enable-all: true + disable: + - godot + - varnamelen + - wrapcheck + - nosnakecase + - deadcode + - golint + - interfacer + - maligned + - ifshort + - structcheck + - exhaustivestruct + - scopelint + - varcheck + - ireturn - depguard - - dogsled -# - dupl - - errcheck - - errorlint -# - exhaustive -# - exhaustivestruct -# - forbidigo -# - funlen -# - gci -# - gocognit - - goconst - - gocritic - - gocyclo -# - godot - - godox - - gofmt # On why gofmt when goimports is enabled - https://github.com/golang/go/issues/21476 - - gofumpt - - goheader - - goimports -# - gomnd -# - gomoddirectives -# - gomodguard - - gosec - - gosimple - - govet - - depguard -# - ifshort -# - ireturn - - lll - - makezero - - misspell - - ineffassign - - misspell - - nakedret - - nestif -# - nilnil -# - nlreturn - - nolintlint - - prealloc - - predeclared - - rowserrcheck - - revive - - staticcheck - - stylecheck -# - tagliatelle -# - testpackage -# - thelper -# - tenv - - typecheck - - unconvert - - unparam - - unused -# - varnamelen - - whitespace -# - wrapcheck -# - wsl + - wsl + - exhaustruct + - gci + - paralleltest #need be enabled issues: # List of regexps of issue texts to exclude, empty list by default. From 914a036060753b702a2588b0b40f939dd4f9b1bd Mon Sep 17 00:00:00 2001 From: mixalight Date: Tue, 5 Dec 2023 16:33:32 +0300 Subject: [PATCH 2/5] update golangci to v1.55.2 --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8804d7f6b..b9682b5b2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.52.0 + version: v1.55.2 golangci-examples: name: golangci-lint-examples concurrency: From 56912660b7f10885251a371c1af94e1a59c76252 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Tue, 26 Dec 2023 12:11:31 +0300 Subject: [PATCH 3/5] switch golangci config rules from "disable all" with exceptions to "enable all" with exceptions --- .golangci.yml | 84 ++++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 955af06d6..f9b8c82c1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,11 +1,5 @@ # options for analysis running run: - # default concurrency is a available CPU number - concurrency: 4 - - # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 5m - # exit code when at least one issue was found, default is 1 issues-exit-code: 1 @@ -58,7 +52,6 @@ linters-settings: govet: # report about shadowed variables check-shadowing: true - fieldalignment: true golint: # minimal confidence for issues, default is 0.8 min-confidence: 0.8 @@ -76,9 +69,6 @@ linters-settings: min-len: 2 # minimal occurrences count to trigger, 3 by default min-occurrences: 2 - fieldalignment: - # print struct with more effective memory layout or not, false by default - suggest-new: true misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. @@ -109,17 +99,7 @@ linters-settings: - name: empty-block - name: superfluous-else - name: unreachable-code - unused: - # treat code as a program (not a library) and report unused exported identifiers; default is false. - # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find funcs usages. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false unparam: - # call graph construction algorithm (cha, rta). In general, use cha for libraries, - # and rta for programs with main packages. Default is cha. - algo: cha - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations @@ -130,7 +110,7 @@ linters-settings: - whyNoLint # https://github.com/go-critic/go-critic/issues/1063 - importShadow - sloppyReassign -# - typeDefFirst + # - typeDefFirst # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. # See https://github.com/go-critic/go-critic#usage -> section "Tags". # Default: [] @@ -227,25 +207,58 @@ linters-settings: linters: enable-all: true disable: - - godot - - varnamelen - - wrapcheck - - nosnakecase + - asasalint + - containedctx + - contextcheck + - cyclop - deadcode + - depguard + - dupl + - dupword + - durationcheck + - errname + - exhaustive + - exhaustivestruct + - exhaustruct + - forbidigo + - forcetypeassert + - funlen + - gci + - gochecknoglobals + - gocognit + - goconst + - godot + - goerr113 - golint + - gomnd + - gosec + - ifshort + - interfacebloat - interfacer + - inamedparam + - ireturn + - maintidx - maligned - - ifshort - - structcheck - - exhaustivestruct + - nilerr + - nilnil + - nlreturn + - nonamedreturns + - nosnakecase + - paralleltest + - protogetter + - revive - scopelint + - structcheck + - sqlclosecheck + - testableexamples + - testpackage + - testifylint + - thelper - varcheck - - ireturn - - depguard + - varnamelen + - wastedassign + - wrapcheck - wsl - - exhaustruct - - gci - - paralleltest #need be enabled issues: # List of regexps of issue texts to exclude, empty list by default. @@ -270,9 +283,6 @@ issues: # Default value for this option is true. exclude-use-default: true - # Maximum issues count per one linter. Set to 0 to disable. Default is 50. - max-per-linter: 0 - # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. max-same-issues: 0 @@ -302,4 +312,4 @@ issues: linters: - staticcheck - path: _test\.go - text: "ydb.Connection is deprecated" + text: "ydb.Connection is deprecated" \ No newline at end of file From 9efc29d50114f230158099af62660f3710b30c85 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Sat, 30 Dec 2023 14:09:29 +0300 Subject: [PATCH 4/5] fix version of golangci-lint for all jobs --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b9682b5b2..8a94673df 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -34,7 +34,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.52.0 + version: v1.55.2 working-directory: examples golangci-slo: name: golangci-lint-slo @@ -51,7 +51,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.52.0 + version: v1.55.2 working-directory: tests/slo autoformatter: name: autoformat check From f2718e1524e847dffaca1344db09bfcda1b113c3 Mon Sep 17 00:00:00 2001 From: Aleksey Myasnikov Date: Sat, 30 Dec 2023 14:16:39 +0300 Subject: [PATCH 5/5] fix --- .golangci.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f9b8c82c1..c335db109 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -208,6 +208,7 @@ linters: enable-all: true disable: - asasalint + - bodyclose - containedctx - contextcheck - cyclop @@ -225,34 +226,41 @@ linters: - funlen - gci - gochecknoglobals + - gochecknoinits - gocognit - goconst - godot - goerr113 - golint - gomnd + - gomoddirectives - gosec - ifshort + - inamedparam - interfacebloat - interfacer - - inamedparam - ireturn - maintidx - maligned + - nakedret - nilerr - nilnil - nlreturn + - noctx - nonamedreturns - nosnakecase - paralleltest + - promlinter - protogetter - revive - scopelint - - structcheck - sqlclosecheck + - structcheck + - tagalign + - tagliatelle - testableexamples - - testpackage - testifylint + - testpackage - thelper - varcheck - varnamelen