From 7d104c8743c39c53b5229216b0a9edeb34fafee9 Mon Sep 17 00:00:00 2001 From: Chris Hager Date: Thu, 18 Sep 2025 17:54:01 +0200 Subject: [PATCH] CI version bump, update golangci-lint to v2 --- .github/workflows/checks.yml | 30 ++++++++++++++---------------- .golangci.yaml | 21 +++++++++++++++++---- cmd/https-client/main.go | 2 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9859330..4a42c55 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,14 +11,16 @@ jobs: name: Test runs-on: ubuntu-latest steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v5 + - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: - go-version: ^1.21 - id: go + go-version: ^1.24 - - name: Check out code into the Go module directory - uses: actions/checkout@v2 + - name: Download dependencies + run: go mod download - name: Run unit tests and generate the coverage report run: make test-race @@ -27,26 +29,22 @@ jobs: name: Lint runs-on: ubuntu-latest steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v5 + - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: - go-version: ^1.21 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 + go-version: ^1.24 - name: Install gofumpt run: go install mvdan.cc/gofumpt@v0.4.0 - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@v0.5.1 + run: go install honnef.co/go/tools/cmd/staticcheck@2025.1.1 - name: Install golangci-lint - run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 - - - name: Install NilAway - run: go install go.uber.org/nilaway/cmd/nilaway@v0.0.0-20240821220108-c91e71c080b7 + run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.2 - name: Lint run: make lint diff --git a/.golangci.yaml b/.golangci.yaml index fc4d5cf..64579af 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,16 +1,15 @@ +version: "2" linters: enable-all: true disable: - cyclop - forbidigo - funlen - - gci - gochecknoglobals - gochecknoinits - gocritic - godot - godox - - gomnd - mnd - lll - nestif @@ -40,8 +39,6 @@ linters: # # Disabled because deprecated: # - - execinquery - - exportloopref linters-settings: # @@ -89,3 +86,19 @@ linters-settings: - 'MockBeaconClient' - 'RelayAPI' - 'Webserver' + +formatters: + enable: + - gci + - gofmt + - gofumpt + - goimports + settings: + gofumpt: + extra-rules: true + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/cmd/https-client/main.go b/cmd/https-client/main.go index 6e7c16d..75f59ef 100644 --- a/cmd/https-client/main.go +++ b/cmd/https-client/main.go @@ -68,7 +68,7 @@ func runCli(cCtx *cli.Context) error { log.Error("http request error", "err", err) return err } - defer resp.Body.Close() + defer resp.Body.Close() //nolint:errcheck respBody, err := io.ReadAll(resp.Body) if err != nil {