From c04d9c446d47facd232ca5df2ab53e0f4542d004 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 29 Aug 2025 15:24:04 -0700 Subject: [PATCH] ci/validate: add modernize run Modernize tool [1] basically ensures that the new language features and packages are used across the code. The reason to run it in CI is to ensure that - PR authors use modern code; - our code is modern whether we bump Go version in go.mod. Shove it into go-fix job which already does a similar thing but for 'go-fix' and rename the whole job to modernize. [1]: https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index c7b37452a..e73a9e317 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -48,7 +48,7 @@ jobs: run: | golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1 - go-fix: + modernize: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 @@ -65,6 +65,10 @@ jobs: run: | go fix ./... git diff --exit-code + - name: run modernize + run: | + go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... + git diff --exit-code compile-buildtags: runs-on: ubuntu-24.04 @@ -260,9 +264,9 @@ jobs: - compile-buildtags - deps - get-images - - go-fix - keyring - lint + - modernize - release - shellcheck - shfmt