From 40d9d573a5dd4d2ed94014880209f62627911260 Mon Sep 17 00:00:00 2001 From: Marin Nozhchev Date: Tue, 16 Sep 2025 20:49:13 +0300 Subject: [PATCH] tests: add modernize check --- .github/workflows/ci.yml | 3 +-- Makefile | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edf228d..64237db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,7 @@ jobs: make test - name: Checks run: | - sudo apt-get install moreutils -y - make check_vuln check_tidy + make checks # platforms: # runs-on: ${{ matrix.os }} diff --git a/Makefile b/Makefile index 1607d5f..54752cc 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,9 @@ short-test: lint: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.5 run -v +.PHONY: checks +checks: check_tidy check_vuln check_modern + .PHONY: check_vuln check_vuln: go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./... @@ -33,3 +36,9 @@ check_tidy: go mod tidy # Verify that `go mod tidy` didn't introduce any changes. Run go mod tidy before pushing. git diff --exit-code --stat go.mod go.sum + +.PHONY: check_modern +check_modern: + go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.20.0 ./... +# non-zero exit status on issues found +# nb: modernize is not part of golangci-lint yet - https://github.com/golangci/golangci-lint/issues/686