From adf07343cf4962ebda162a88940805684240e3e9 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 15 Dec 2025 10:45:18 -0800 Subject: [PATCH 1/4] libc/int: use strings.Builder Generated by modernize@latest (v0.21.0). Signed-off-by: Kir Kolyshkin (cherry picked from commit 652269729dea0a866d32f71f5065212b14fec2f0) Signed-off-by: Kir Kolyshkin --- libcontainer/integration/exec_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index a6bd38955..e977b36a9 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -1067,15 +1067,16 @@ func TestHook(t *testing.T) { ok(t, err) // e.g: 'ls /prestart ...' - cmd := "ls " + var cmd strings.Builder + cmd.WriteString("ls ") for _, hook := range hookFiles { - cmd += "/" + hook + " " + cmd.WriteString("/" + hook + " ") } var stdout bytes.Buffer pconfig := libcontainer.Process{ Cwd: "/", - Args: []string{"sh", "-c", cmd}, + Args: []string{"sh", "-c", cmd.String()}, Env: standardEnvironment, Stdin: nil, Stdout: &stdout, From 701561e3f0650963b998988e60a7b52b842c00f1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 15 Dec 2025 10:37:12 -0800 Subject: [PATCH 2/4] ci: use latest Go for modernize job Since we use modernize@latest, it may require latest Go as well (and now it does), so use "go-version: stable" explicitly (which resolves to latest Go). This fixes the issue with CI: > go: golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest: golang.org/x/tools/gopls@v0.21.0 requires go >= 1.25 (running go 1.24.11; GOTOOLCHAIN=local) Signed-off-by: Kir Kolyshkin (cherry picked from commit 16ee2bbf4cd7dc61b6920fc546b5e9d8e0dbbab1) Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 1a8a86ad1..4b722fb53 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,7 +57,7 @@ jobs: fetch-depth: 2 - uses: actions/setup-go@v6 with: - go-version: "${{ env.GO_VERSION }}" + go-version: stable # modernize@latest may require latest Go. - name: install deps run: | sudo apt -q update From a239670e4b1d97dba73f619af5817e9d855a14c4 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 15 Dec 2025 10:46:55 -0800 Subject: [PATCH 3/4] ci: drop -test from modernize run The modernize documentation used to suggest -test flag but it's not needed as it is enabled by default. Drop it. Signed-off-by: Kir Kolyshkin (cherry picked from commit dbc4234607a552ae303174da0621ffb24a925228) Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 4b722fb53..807e7087e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -68,7 +68,7 @@ jobs: git diff --exit-code - name: run modernize run: | - go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... + go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./... git diff --exit-code compile-buildtags: From 1b249320aaa24ca54c224b93f969949419f7d4b3 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 17 Dec 2025 11:57:00 -0800 Subject: [PATCH 4/4] ci: fix modernize URL Signed-off-by: Kir Kolyshkin (cherry picked from commit 428043bcf2374a64acc7c2039b9e940735af11b4) Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 807e7087e..b4f0dae8b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -68,7 +68,7 @@ jobs: git diff --exit-code - name: run modernize run: | - go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./... + go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -fix ./... git diff --exit-code compile-buildtags: