From 0ee7f7514c9e77147238e5fd51d0c911c3234b4c Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Wed, 1 Apr 2026 11:31:46 -0700 Subject: [PATCH 1/2] Bump golangci-lint to v2 Manual backport of etcd-io#954 / 675a3be. Silence linters that fail with the current state of the code, as we don't want to change the stable release code. Signed-off-by: Ivan Valdes --- .github/workflows/tests-template.yml | 6 ++--- .github/workflows/tests_windows.yml | 6 ++--- .golangci.yaml | 39 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 .golangci.yaml diff --git a/.github/workflows/tests-template.yml b/.github/workflows/tests-template.yml index 78c842fc1..e3f4bdf1b 100644 --- a/.github/workflows/tests-template.yml +++ b/.github/workflows/tests-template.yml @@ -51,7 +51,7 @@ jobs: exit 1 ;; esac - - name: golangci-lint - uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: - version: v1.64.8 + version: v2.10.1 diff --git a/.github/workflows/tests_windows.yml b/.github/workflows/tests_windows.yml index 7f811ed2a..b2d9055d5 100644 --- a/.github/workflows/tests_windows.yml +++ b/.github/workflows/tests_windows.yml @@ -39,10 +39,10 @@ jobs: ;; esac shell: bash - - name: golangci-lint - uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: - version: v1.64.8 + version: v2.10.1 coverage: needs: ["test-windows"] diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 000000000..c066e249e --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,39 @@ +formatters: + enable: + - gofmt + - goimports + settings: # please keep this alphabetized + goimports: + local-prefixes: + - go.etcd.io # Put imports beginning with prefix after 3rd-party packages. +issues: + max-same-issues: 0 +linters: + default: none + enable: # please keep this alphabetized + - errcheck + - govet + - ineffassign + - staticcheck + - unused + exclusions: + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + settings: # please keep this alphabetized + staticcheck: + checks: + - all + - -QF1003 # Convert if/else-if chain to tagged switch + - -QF1004 # Use strings.ReplaceAll instead of strings.Replace with n == -1 + - -QF1010 # Convert slice of bytes to string when printing it + - -QF1011 # Omit redundant type from variable declaration + - -ST1003 # Poorly chosen identifier + - -ST1005 # Incorrectly formatted error string + - -ST1006 # Poorly chosen receiver name + - -ST1012 # Poorly chosen name for error variable + - -ST1016 # Use consistent method receiver names + - -ST1023 # Redundant type in variable declaration +version: "2" From 0020e2fd162eb49e338cb51aa9de59b37e562098 Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Mon, 13 Apr 2026 15:51:04 -0700 Subject: [PATCH 2/2] Remove linting from Windows This has been a dead end for several attempts. Golangci-lint fails for every file for Windows. The easier approach, given this is a stable rlease branch is to disable linting in Windows. Signed-off-by: Ivan Valdes --- .github/workflows/tests_windows.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/tests_windows.yml b/.github/workflows/tests_windows.yml index b2d9055d5..46fd26a64 100644 --- a/.github/workflows/tests_windows.yml +++ b/.github/workflows/tests_windows.yml @@ -39,10 +39,6 @@ jobs: ;; esac shell: bash - - name: Run golangci-lint - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 - with: - version: v2.10.1 coverage: needs: ["test-windows"]