Skip to content

Commit 7cc0f9c

Browse files
build(deps): bump github.com/sonatard/noctx from 0.3.4 to 0.3.5 (#5916)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 90a403c commit 7cc0f9c

File tree

7 files changed

+34
-20
lines changed

7 files changed

+34
-20
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ require (
104104
github.com/shirou/gopsutil/v4 v4.25.6
105105
github.com/sirupsen/logrus v1.9.3
106106
github.com/sivchari/containedctx v1.0.3
107-
github.com/sonatard/noctx v0.3.4
107+
github.com/sonatard/noctx v0.3.5
108108
github.com/sourcegraph/go-diff v0.7.0
109109
github.com/spf13/cobra v1.9.1
110110
github.com/spf13/pflag v1.0.6

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/website/dump_info/main.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bytes"
5+
"context"
56
"encoding/json"
67
"fmt"
78
"log"
@@ -33,7 +34,7 @@ func main() {
3334
log.Fatalf("Save default exclusions: %v", err)
3435
}
3536

36-
err = saveCLIHelp(filepath.Join("assets", "cli-help.json"))
37+
err = saveCLIHelp(context.Background(), filepath.Join("assets", "cli-help.json"))
3738
if err != nil {
3839
log.Fatalf("Save CLI help: %v", err)
3940
}
@@ -139,25 +140,25 @@ func saveDefaultExclusions() error {
139140
return saveToJSONFile(filepath.Join("assets", "exclusion-presets.json"), data)
140141
}
141142

142-
func saveCLIHelp(dst string) error {
143-
err := exec.Command("make", "build").Run()
143+
func saveCLIHelp(ctx context.Context, dst string) error {
144+
err := exec.CommandContext(ctx, "make", "build").Run()
144145
if err != nil {
145146
return fmt.Errorf("can't run make build: %w", err)
146147
}
147148

148-
lintersOut, err := exec.Command("./golangci-lint", "help", "linters").Output()
149+
lintersOut, err := exec.CommandContext(ctx, "./golangci-lint", "help", "linters").Output()
149150
if err != nil {
150151
return fmt.Errorf("can't run linters cmd: %w", err)
151152
}
152153

153154
lintersOutParts := bytes.Split(lintersOut, []byte("\n\n"))
154155

155-
rumCmdHelp, err := getCmdHelp("run")
156+
rumCmdHelp, err := getCmdHelp(ctx, "run")
156157
if err != nil {
157158
return err
158159
}
159160

160-
fmtCmdHelp, err := getCmdHelp("fmt")
161+
fmtCmdHelp, err := getCmdHelp(ctx, "fmt")
161162
if err != nil {
162163
return err
163164
}
@@ -171,8 +172,8 @@ func saveCLIHelp(dst string) error {
171172
return saveToJSONFile(dst, data)
172173
}
173174

174-
func getCmdHelp(name string) (string, error) {
175-
helpCmd := exec.Command("./golangci-lint", name, "-h")
175+
func getCmdHelp(ctx context.Context, name string) (string, error) {
176+
helpCmd := exec.CommandContext(ctx, "./golangci-lint", name, "-h")
176177
helpCmd.Env = append(helpCmd.Env, os.Environ()...)
177178

178179
help, err := helpCmd.Output()

test/bench/bench_test.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package bench
22

33
import (
44
"bytes"
5+
"context"
56
"errors"
67
"fmt"
78
"go/build"
@@ -63,7 +64,8 @@ func Benchmark_linters(b *testing.B) {
6364

6465
for _, repo := range repos {
6566
b.Run(repo.name, func(b *testing.B) {
66-
_ = exec.Command(binName, "cache", "clean").Run()
67+
// TODO(ldez): clean inside go1.25 PR
68+
_ = exec.CommandContext(context.Background(), binName, "cache", "clean").Run()
6769

6870
err = os.Chdir(repo.dir)
6971
require.NoErrorf(b, err, "can't chdir to %s", repo.dir)
@@ -94,7 +96,8 @@ func Benchmark_golangciLint(b *testing.B) {
9496

9597
installGolangCILint(b)
9698

97-
_ = exec.Command(binName, "cache", "clean").Run()
99+
// TODO(ldez): clean inside go1.25 PR
100+
_ = exec.CommandContext(context.Background(), binName, "cache", "clean").Run()
98101

99102
cases := getAllRepositories(b)
100103

@@ -177,7 +180,8 @@ func cloneGithubProject(tb testing.TB, benchRoot, owner, name string) string {
177180
if _, err := os.Stat(dir); os.IsNotExist(err) {
178181
repo := fmt.Sprintf("https://github.com/%s/%s.git", owner, name)
179182

180-
err = exec.Command("git", "clone", "--depth", "1", "--single-branch", repo, dir).Run()
183+
// TODO(ldez): clean inside go1.25 PR
184+
err = exec.CommandContext(context.Background(), "git", "clone", "--depth", "1", "--single-branch", repo, dir).Run()
181185
if err != nil {
182186
tb.Fatalf("can't git clone %s/%s: %s", owner, name, err)
183187
}
@@ -210,7 +214,8 @@ func launch(tb testing.TB, run func(testing.TB, string, []string), args []string
210214
func run(tb testing.TB, name string, args []string) {
211215
tb.Helper()
212216

213-
cmd := exec.Command(name, args...)
217+
// TODO(ldez): clean inside go1.25 PR
218+
cmd := exec.CommandContext(context.Background(), name, args...)
214219
if os.Getenv("PRINT_CMD") == "1" {
215220
log.Print(strings.Join(cmd.Args, " "))
216221
}
@@ -228,7 +233,8 @@ func run(tb testing.TB, name string, args []string) {
228233
func countGoLines(tb testing.TB) int {
229234
tb.Helper()
230235

231-
cmd := exec.Command("bash", "-c", `find . -type f -name "*.go" | grep -F -v vendor | xargs wc -l | tail -1`)
236+
// TODO(ldez): clean inside go1.25 PR
237+
cmd := exec.CommandContext(context.Background(), "bash", "-c", `find . -type f -name "*.go" | grep -F -v vendor | xargs wc -l | tail -1`)
232238

233239
out, err := cmd.CombinedOutput()
234240
if err != nil {
@@ -341,7 +347,8 @@ func installGolangCILint(tb testing.TB) {
341347

342348
parentPath := findMakefile(tb)
343349

344-
cmd := exec.Command("make", "-C", parentPath, "build")
350+
// TODO(ldez): clean inside go1.25 PR
351+
cmd := exec.CommandContext(context.Background(), "make", "-C", parentPath, "build")
345352

346353
output, err := cmd.CombinedOutput()
347354
if err != nil {

test/testshared/install.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package testshared
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67
"os"
@@ -48,7 +49,8 @@ func InstallGolangciLint(tb testing.TB) string {
4849
defer builtLock.Unlock()
4950

5051
if !built {
51-
cmd := exec.Command("make", "-C", parentPath, "build")
52+
// TODO(ldez): clean inside go1.25 PR
53+
cmd := exec.CommandContext(context.Background(), "make", "-C", parentPath, "build")
5254

5355
output, err := cmd.CombinedOutput()
5456
require.NoError(tb, err, "can't install golangci-lint %s", string(output))

test/testshared/integration/fix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package integration
22

33
import (
4+
"context"
45
"os"
56
"os/exec"
67
"path/filepath"
@@ -30,7 +31,8 @@ func setupTestFix(t *testing.T) []string {
3031

3132
sourcesDir := filepath.Join(testdataDir, "fix")
3233

33-
err := exec.Command("cp", "-R", sourcesDir, tmpDir).Run()
34+
// TODO(ldez): clean inside go1.25 PR
35+
err := exec.CommandContext(context.Background(), "cp", "-R", sourcesDir, tmpDir).Run()
3436
require.NoError(t, err)
3537

3638
return findSources(t, tmpDir, "in", "*.go")

test/testshared/runner.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package testshared
22

33
import (
4+
"context"
45
"os"
56
"os/exec"
67
"path/filepath"
@@ -263,8 +264,9 @@ func (r *Runner) Command() *exec.Cmd {
263264

264265
runArgs := append([]string{r.command}, r.args...)
265266

267+
// TODO(ldez): clean inside go1.25 PR
266268
//nolint:gosec // we don't use user input here
267-
cmd := exec.Command(r.binPath, runArgs...)
269+
cmd := exec.CommandContext(context.Background(), r.binPath, runArgs...)
268270
cmd.Env = append(os.Environ(), r.env...)
269271

270272
return cmd

0 commit comments

Comments
 (0)