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)