diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5f2188f..b94db91 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,9 +1,15 @@ name: golangci-lint + on: push: branches: - - master + - '**' pull_request: + branches: + - master + +permissions: + contents: read jobs: golangci: @@ -13,5 +19,16 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v4 + - name: Get go version from go.mod + run: | + echo "GO_VERSION=$(grep '^go ' go.mod | cut -d " " -f 2)" >> $GITHUB_ENV + + - name: Setup-go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60.3 diff --git a/.golangci.yml b/.golangci.yml index 507b293..ea52710 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,33 +1,53 @@ run: - skip-dirs: - - benchmarks + timeout: 2m linters: disable-all: true enable: - dupl - errcheck - - exportloopref + - errname + - errorlint - funlen + - gci - goconst - gocritic - gocyclo - gofmt - goimports + - gosec - gosimple - govet - ineffassign - lll - misspell + - nolintlint - prealloc - revive - staticcheck + - stylecheck + - thelper + - tparallel - typecheck - unconvert + - unparam + - unused + - whitespace + +linters-settings: + gosec: + excludes: + - G115 + thelper: + test: + begin: false issues: exclude-rules: - # Exclude some linters from running on tests files. - path: _test\.go linters: - errcheck + - funlen + + exclude-dirs: + - benchmarks diff --git a/value_test.go b/value_test.go index 36eba62..4b95725 100644 --- a/value_test.go +++ b/value_test.go @@ -7,7 +7,6 @@ import ( "github.com/reugn/async/internal/util" ) -//nolint:funlen func TestValueCompareAndSwap(t *testing.T) { var value Value swapped := value.CompareAndSwap(1, 2)