From 374d97c907d981f7c367b2b659c3bf3f018169be Mon Sep 17 00:00:00 2001 From: adrianbrad Date: Fri, 23 Oct 2026 20:02:07 +0300 Subject: [PATCH] ci(lint): pin golangci-lint and fix issues from v2.15.0 The workflow installed golangci-lint `latest`, so new releases started failing main without any code change (since ~2026-08-31), and every open PR inherited the red Lint check. - Pin golangci-lint to v2.15.0. - Disable revive's new marshal-receiver rule: every queue holds a sync mutex, so a value receiver on MarshalJSON would copy the lock. - Remove redundant parentheses in priority.go flagged by newer gofumpt. - Replace the deprecated gofumpt extra-rules setting with extra.group-params and extra.clothe-returns. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/lint-test.yaml | 2 +- .golangci.yml | 7 ++++++- priority.go | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index c124122..514decc 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -24,7 +24,7 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 with: - version: latest + version: v2.15.0 args: --timeout 5m test: diff --git a/.golangci.yml b/.golangci.yml index 2bae7e7..8ccd284 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -140,6 +140,9 @@ linters: disabled: true - name: modifies-parameter disabled: true + # Every queue holds a sync mutex; a value receiver on MarshalJSON would copy it. + - name: marshal-receiver + disabled: true - name: var-naming arguments: - [] @@ -203,7 +206,9 @@ formatters: - gofumpt settings: gofumpt: - extra-rules: true + extra: + group-params: true + clothe-returns: true exclusions: generated: lax paths: diff --git a/priority.go b/priority.go index 2b51202..67aee4c 100644 --- a/priority.go +++ b/priority.go @@ -46,9 +46,9 @@ func (h *priorityHeap[T]) Push(elem any) { func (h *priorityHeap[T]) Pop() any { n := len(h.elems) - elem := (h.elems)[n-1] + elem := h.elems[n-1] - h.elems = (h.elems)[0 : n-1] + h.elems = h.elems[0 : n-1] return elem } @@ -115,10 +115,10 @@ func NewPriority[T comparable]( // provided, the elements are sorted and trimmed to fit the capacity. if options.capacity != nil && *options.capacity < elementsHeap.Len() { sort.Slice(elementsHeap.elems, func(i, j int) bool { - return lessFunc((elementsHeap.elems)[i], (elementsHeap.elems)[j]) + return lessFunc(elementsHeap.elems[i], elementsHeap.elems[j]) }) - elementsHeap.elems = (elementsHeap.elems)[:*options.capacity] + elementsHeap.elems = elementsHeap.elems[:*options.capacity] } heap.Init(elementsHeap)