From f8a3ec528ea07a55fd7d5f466e43a876c6a8e59c Mon Sep 17 00:00:00 2001 From: Billy Lynch Date: Wed, 17 Apr 2024 10:26:19 -0700 Subject: [PATCH 1/2] Actually use golangci-lint config. golangci-config uses `.golangci.yaml` as the default config path. Previously we were using `.golang-ci.yaml` so changes weren't taking affect. --- .github/workflows/lint.yaml | 4 +- .golang-ci.yaml | 86 ------------------------------------- .golangci.yaml | 68 +++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 88 deletions(-) delete mode 100644 .golang-ci.yaml create mode 100644 .golangci.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3db155945f..9e16e168fa 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version version: latest @@ -33,7 +33,7 @@ jobs: # working-directory: somedir # Optional: golangci-lint command line arguments. - args: --timeout 10m0s + # args: --config=.golangci.yml # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true diff --git a/.golang-ci.yaml b/.golang-ci.yaml deleted file mode 100644 index 48a26f05e7..0000000000 --- a/.golang-ci.yaml +++ /dev/null @@ -1,86 +0,0 @@ -# Documentation: https://golangci-lint.run/usage/configuration/ -linters-settings: -linters: - enable: - - bodyclose - - containedctx - - decorder - - depguard - - dogsled - - dupl - - dupword - - errcheck - - errchkjson - - errname - - errorlint - - exhaustive - - goconst - - gocritic - - gofmt - - goimports - - gomodguard - - gosec - - gosimple - - govet - - ireturn - - maintidx - - makezero - - misspell - - musttag - - nakedret - - nilerr - - nilnil - - noctx - - nolintlint - - nosprintfhostport - - revive - - staticheck - - thelper - - typecheck - - unconvert - - unparam - - unused - - usestdlibvars - - whitespace - - wrapcheck - # Enabling presets means that new linters that we automatically adopt new - # linters that augment a preset. This also opts us in for replacement linters - # when a linter is deprecated. - presets: - - bugs - - comment - - complexity - - error - - format - - import - - metalinter - - module - - performance - - sql - - style - - test - - unused -output: - uniq-by-line: false -issues: - # Only flag new issues - new: true - exclude-rules: - - path: _test\.go - linters: - - errcheck - - gosec - max-issues-per-linter: 0 - max-same-issues: 0 - include: - # Enable off-by-default rules for revive requiring that all exported elements have a properly formatted comment. - - EXC0012 # https://golangci-lint.run/usage/false-positives/#exc0012 - - EXC0014 # https://golangci-lint.run/usage/false-positives/#exc0014 -run: - issues-exit-code: 1 - build-tags: - - e2e - skip-dirs: - - vendor - timeout: 20m - modules-download-mode: vendor diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000000..9b572e6fc3 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,68 @@ +# Documentation: https://golangci-lint.run/usage/configuration/ +linters: + disable-all: true + enable: + - bodyclose + - containedctx + - decorder + - depguard + - dogsled + - dupl + - dupword + - errcheck + - errchkjson + - errname + - errorlint + - exhaustive + - goconst + - gocritic + - gofmt + - goimports + - gomodguard + - gosec + - gosimple + - govet + - ireturn + - maintidx + - makezero + - misspell + - musttag + - nakedret + - nilerr + - nilnil + - noctx + - nolintlint + - nosprintfhostport + - revive + - staticcheck + - thelper + - typecheck + - unconvert + - unparam + - unused + - usestdlibvars + - whitespace +output: + uniq-by-line: false +issues: + # Only flag new issues + new: true + exclude-rules: + - path: _test\.go + linters: + - errcheck + - gosec + max-issues-per-linter: 0 + max-same-issues: 0 + include: + # Enable off-by-default rules for revive requiring that all exported elements have a properly formatted comment. + - EXC0012 # https://golangci-lint.run/usage/false-positives/#exc0012 + - EXC0014 # https://golangci-lint.run/usage/false-positives/#exc0014 +run: + issues-exit-code: 1 + build-tags: + - e2e + # skip-dirs: + # - vendor + timeout: 20m + modules-download-mode: vendor From dbcad24c88343dac2bcdc53a552efe26b6dd482a Mon Sep 17 00:00:00 2001 From: Billy Lynch <1844673+wlynch@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:20:23 -0400 Subject: [PATCH 2/2] Update lint.yaml --- .github/workflows/lint.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 9e16e168fa..fd7a604c45 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -33,7 +33,6 @@ jobs: # working-directory: somedir # Optional: golangci-lint command line arguments. - # args: --config=.golangci.yml # Optional: show only new issues if it's a pull request. The default value is `false`. only-new-issues: true