diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 110e6fa7..1eff326e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ["1.21", "1.22", stable] + go-version: ["1.22", "1.23", stable] steps: - name: Checkout Repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -90,7 +90,7 @@ jobs: run: docker compose up test-no-stream --exit-code-from test-no-stream - name: Create/Update Draft - uses: lucacome/draft-release@5d29432a46bff6c122cd4b07a1fb94e1bb158d34 # v1.1.1 + uses: lucacome/draft-release@f15262dc3ac8c3efbf09a8ce5406cd0fc47aabb1 # v1.2.2 id: release-notes with: minor-label: "enhancement" @@ -106,7 +106,7 @@ jobs: if: ${{ github.ref_type == 'tag' }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 + uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 with: version: v2.7.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: release --clean diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dcda7517..136bd717 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -58,7 +58,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -70,6 +70,6 @@ jobs: # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dd4e6cb6..ab1714a4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,9 +33,9 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: - version: v1.64.8 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.1.5 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Lint Actions - uses: reviewdog/action-actionlint@db58217885f9a6570da9c71be4e40ec33fe44a1f # v1.65.0 + uses: reviewdog/action-actionlint@a5524e1c19e62881d79c1f1b9b6f09f16356e281 # v1.65.2 with: actionlint_flags: -shellcheck "" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index d6dedaef..e3dec9e7 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10 + uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 with: sarif_file: results.sarif diff --git a/.golangci.yml b/.golangci.yml index 0624468a..07d01b78 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,44 +1,6 @@ -linters-settings: - misspell: - locale: US - revive: - ignore-generated-header: true - rules: - - name: blank-imports - - name: constant-logical-expr - - name: context-as-argument - - name: context-keys-type - - name: defer - - name: dot-imports - - name: duplicated-imports - - name: empty-block - - name: error-naming - - name: error-return - - name: error-strings - - name: errorf - - name: exported - - name: import-shadowing - - name: increment-decrement - - name: indent-error-flow - - name: package-comments - - name: range - - name: range-val-address - - name: range-val-in-closure - - name: receiver-naming - - name: redefines-builtin-id - - name: string-of-int - - name: superfluous-else - - name: time-naming - - name: unchecked-type-assertion - - name: unexported-return - - name: unnecessary-stmt - - name: unreachable-code - - name: unused-parameter - - name: var-declaration - - name: var-naming - govet: - enable-all: true +version: "2" linters: + default: none enable: - asasalint - asciicheck @@ -59,11 +21,7 @@ linters: - gochecksumtype - gocritic - godot - - gofmt - - gofumpt - - goimports - gosec - - gosimple - gosmopolitan - govet - ineffassign @@ -75,19 +33,16 @@ linters: - nilerr - noctx - nolintlint + - paralleltest - perfsprint - prealloc - predeclared - - paralleltest - reassign - revive - staticcheck - - stylecheck - tagalign - - tenv - thelper - tparallel - - typecheck - unconvert - unparam - unused @@ -95,9 +50,67 @@ linters: - wastedassign - whitespace - wrapcheck - disable-all: true + settings: + govet: + enable-all: true + misspell: + locale: US + revive: + rules: + - name: blank-imports + - name: constant-logical-expr + - name: context-as-argument + - name: context-keys-type + - name: defer + - name: dot-imports + - name: duplicated-imports + - name: empty-block + - name: error-naming + - name: error-return + - name: error-strings + - name: errorf + - name: exported + - name: import-shadowing + - name: increment-decrement + - name: indent-error-flow + - name: package-comments + - name: range + - name: range-val-address + - name: range-val-in-closure + - name: receiver-naming + - name: redefines-builtin-id + - name: string-of-int + - name: superfluous-else + - name: time-naming + - name: unchecked-type-assertion + - name: unexported-return + - name: unnecessary-stmt + - name: unreachable-code + - name: unused-parameter + - name: var-declaration + - name: var-naming + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ issues: max-issues-per-linter: 0 max-same-issues: 0 -run: - timeout: 5m +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 09c5c069..fedbc5f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,12 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.64.8 + rev: v2.0.2 hooks: - id: golangci-lint-full - repo: https://github.com/gitleaks/gitleaks - rev: v8.24.0 + rev: v8.24.3 hooks: - id: gitleaks @@ -39,7 +39,7 @@ repos: - id: markdownlint-cli2 - repo: https://github.com/adrienverge/yamllint.git - rev: v1.35.1 + rev: v1.37.0 hooks: - id: yamllint diff --git a/Makefile b/Makefile index a8b93c55..33e974d8 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.64.8 +GOLANGCI_LINT_VERSION = v2.1.5 test: unit-test test-integration test-integration-no-stream-block clean lint: - go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --fix + go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --fix unit-test: go test -v -shuffle=on -race client/*.go diff --git a/client/nginx_test.go b/client/nginx_test.go index 8d565cae..6d1661a0 100644 --- a/client/nginx_test.go +++ b/client/nginx_test.go @@ -677,8 +677,8 @@ func TestClientWithMaxAPI(t *testing.T) { t.Parallel() // Test creating a new client with max API version ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.RequestURI == "/": + switch r.RequestURI { + case "/": _, err := w.Write([]byte(tt.apiVersions)) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -852,8 +852,8 @@ func TestGetStats_SSL(t *testing.T) { func TestGetMaxAPIVersionServer(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.RequestURI == "/": + switch r.RequestURI { + case "/": _, err := w.Write([]byte(`[4, 5, 6, 7]`)) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -884,8 +884,8 @@ func TestGetMaxAPIVersionServer(t *testing.T) { func TestGetMaxAPIVersionClient(t *testing.T) { t.Parallel() ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.RequestURI == "/": + switch r.RequestURI { + case "/": _, err := w.Write([]byte(`[4, 5, 6, 7, 8, 9, 25]`)) if err != nil { t.Fatalf("unexpected error: %v", err) diff --git a/compose.yaml b/compose.yaml index d1b0433c..c68d0f67 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,7 +29,7 @@ services: service: nginx test: - image: golang:1.23 + image: golang:1.24 volumes: - type: bind source: ./ diff --git a/docker/Dockerfile b/docker/Dockerfile index b8099ac5..f31000aa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.14 +# syntax=docker/dockerfile:1.15 FROM debian:12-slim LABEL maintainer="NGINX Docker Maintainers " diff --git a/go.mod b/go.mod index df9b5eff..90276c54 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/nginx/nginx-plus-go-client/v2 -go 1.22.6 +go 1.24.2 -require golang.org/x/sync v0.11.0 +require golang.org/x/sync v0.13.0 diff --git a/go.sum b/go.sum index dffd122c..67fee8ff 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=