From e629c689fb6d92e7b43e930658250f7b6d182f1c Mon Sep 17 00:00:00 2001 From: Mike Jensen Date: Wed, 3 Dec 2025 23:23:03 -0700 Subject: [PATCH] chore: golangci update --- .github/workflows/tests-workflow.yml | 6 ++-- .golangci.yml | 47 ++++++++++++++++++++++++++++ Makefile | 2 +- slices_test.go | 2 +- 4 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/tests-workflow.yml b/.github/workflows/tests-workflow.yml index ac0306b..cd0f7d4 100644 --- a/.github/workflows/tests-workflow.yml +++ b/.github/workflows/tests-workflow.yml @@ -8,7 +8,7 @@ jobs: name: Verify Linting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 @@ -17,7 +17,7 @@ jobs: - name: Set up golangci-lint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.64.8/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v2.6.2/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.6.2 - name: Run lint check run: make lint @@ -43,7 +43,7 @@ jobs: - '1.19' - '1.18' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v6 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..9e50088 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,47 @@ +version: 2 + +linters: + enable: + - asasalint + - asciicheck + - bidichk + - contextcheck + - decorder + - durationcheck + - errcheck + - errorlint + - exptostd + - fatcontext + - gocheckcompilerdirectives + - gochecksumtype + - goconst + - godoclint + - gosmopolitan + - grouper + - iface + - importas + - mirror + - misspell + - musttag + - perfsprint + - prealloc + - reassign + - recvcheck + - sloglint + - testifylint + - thelper + - unconvert + - wastedassign + - whitespace + settings: + goconst: + min-len: 4 + min-occurrences: 4 + +formatters: + enable: + - gofmt + - goimports + +run: + timeout: 600s diff --git a/Makefile b/Makefile index e9a7993..6e3ba2d 100644 --- a/Makefile +++ b/Makefile @@ -13,5 +13,5 @@ bench: go test --benchmem -benchtime=10s -bench='Benchmark.*' -run='^$$' lint: - golangci-lint run --timeout=600s --enable=asasalint,asciicheck,bidichk,containedctx,contextcheck,decorder,durationcheck,errorlint,exptostd,fatcontext,forbidigo,gocheckcompilerdirectives,gochecksumtype,goconst,gofmt,goimports,gosmopolitan,grouper,iface,importas,mirror,misspell,nilerr,nilnil,perfsprint,prealloc,reassign,recvcheck,sloglint,testifylint,unconvert,wastedassign,whitespace && go vet ./... + golangci-lint run --timeout=600s && go vet ./... diff --git a/slices_test.go b/slices_test.go index 720a86a..d718de3 100644 --- a/slices_test.go +++ b/slices_test.go @@ -3647,7 +3647,7 @@ func TestSlicePrepend(t *testing.T) { result := SlicePrepend(tt.elem, tt.slices...) assert.Equal(t, tt.expected, result) // Verify exact allocation size - assert.Equal(t, len(tt.expected), len(result)) + assert.Len(t, result, len(tt.expected)) assert.Equal(t, len(tt.expected), cap(result)) }) }