Skip to content

Commit 5a36865

Browse files
committed
buildlet: add context argument to Client.Exec
(And update all the callers in the tree.) Updates golang/go#35707 Change-Id: I504ef73ea4ba7f8028f47a658c1cd519c7b5d986 Reviewed-on: https://go-review.googlesource.com/c/build/+/207908 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent f7862f7 commit 5a36865

File tree

8 files changed

+55
-50
lines changed

8 files changed

+55
-50
lines changed

buildlet/buildletclient.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,6 @@ type ExecOpts struct {
507507
// response from the buildlet, but before the output begins
508508
// writing to Output.
509509
OnStartExec func()
510-
511-
// Timeout is an optional duration before ErrTimeout is returned.
512-
Timeout time.Duration
513510
}
514511

515512
var ErrTimeout = errors.New("buildlet: timeout waiting for command to complete")
@@ -521,7 +518,10 @@ var ErrTimeout = errors.New("buildlet: timeout waiting for command to complete")
521518
// were system errors preventing the command from being started or
522519
// seen to completition. If execErr is non-nil, the remoteErr is
523520
// meaningless.
524-
func (c *Client) Exec(cmd string, opts ExecOpts) (remoteErr, execErr error) {
521+
//
522+
// If the context's deadline is exceeded, the returned execErr is
523+
// ErrTimeout.
524+
func (c *Client) Exec(ctx context.Context, cmd string, opts ExecOpts) (remoteErr, execErr error) {
525525
var mode string
526526
if opts.SystemLevel {
527527
mode = "sys"
@@ -545,6 +545,7 @@ func (c *Client) Exec(cmd string, opts ExecOpts) (remoteErr, execErr error) {
545545
if err != nil {
546546
return nil, err
547547
}
548+
req = req.WithContext(ctx)
548549
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
549550

550551
// The first thing the buildlet's exec handler does is flush the headers, so
@@ -596,17 +597,16 @@ func (c *Client) Exec(cmd string, opts ExecOpts) (remoteErr, execErr error) {
596597
resc <- errs{} // success
597598
}
598599
}()
599-
var timer <-chan time.Time
600-
if opts.Timeout > 0 {
601-
t := time.NewTimer(opts.Timeout)
602-
defer t.Stop()
603-
timer = t.C
604-
}
605600
select {
606-
case <-timer:
607-
c.MarkBroken()
608-
return nil, ErrTimeout
609601
case res := <-resc:
602+
if res.execErr != nil {
603+
c.MarkBroken()
604+
if res.execErr == context.DeadlineExceeded {
605+
// Historical pre-context value.
606+
// TODO: update docs & callers to just use the context value.
607+
res.execErr = ErrTimeout
608+
}
609+
}
610610
return res.remoteErr, res.execErr
611611
case <-c.peerDead:
612612
return nil, c.deadErr

cmd/coordinator/coordinator.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ func (st *buildStatus) runAllSharded() (remoteErr, err error) {
20612061
st.getHelpersReadySoon()
20622062

20632063
if !st.useSnapshot() {
2064-
remoteErr, err = st.goBuilder().RunMake(st.bc, st)
2064+
remoteErr, err = st.goBuilder().RunMake(st.ctx, st.bc, st)
20652065
if err != nil {
20662066
return nil, err
20672067
}
@@ -2128,7 +2128,7 @@ func (st *buildStatus) crossCompileMakeAndSnapshot(config *dashboard.CrossCompil
21282128

21292129
goos, goarch := st.conf.GOOS(), st.conf.GOARCH()
21302130

2131-
remoteErr, err := kubeBC.Exec("/bin/bash", buildlet.ExecOpts{
2131+
remoteErr, err := kubeBC.Exec(st.ctx, "/bin/bash", buildlet.ExecOpts{
21322132
SystemLevel: true,
21332133
Args: []string{
21342134
"-c",
@@ -2175,7 +2175,7 @@ func (st *buildStatus) crossCompileMakeAndSnapshot(config *dashboard.CrossCompil
21752175
func (st *buildStatus) runAllLegacy() (remoteErr, err error) {
21762176
allScript := st.conf.AllScript()
21772177
sp := st.CreateSpan("legacy_all_path", allScript)
2178-
remoteErr, err = st.bc.Exec(path.Join("go", allScript), buildlet.ExecOpts{
2178+
remoteErr, err = st.bc.Exec(st.ctx, path.Join("go", allScript), buildlet.ExecOpts{
21792179
Output: st,
21802180
ExtraEnv: st.conf.Env(),
21812181
Debug: true,
@@ -2310,7 +2310,7 @@ func (st *buildStatus) distTestList() (names []string, remoteErr, err error) {
23102310
args = append(args, "--compile-only")
23112311
}
23122312
var buf bytes.Buffer
2313-
remoteErr, err = st.bc.Exec("go/bin/go", buildlet.ExecOpts{
2313+
remoteErr, err = st.bc.Exec(st.ctx, "go/bin/go", buildlet.ExecOpts{
23142314
Output: &buf,
23152315
ExtraEnv: append(st.conf.Env(), "GOROOT="+goroot),
23162316
OnStartExec: func() { st.LogEventTime("discovering_tests") },
@@ -2533,7 +2533,7 @@ func (st *buildStatus) runSubrepoTests() (remoteErr, err error) {
25332533
repoPath := importPathOfRepo(st.SubName)
25342534
var buf bytes.Buffer
25352535
sp := st.CreateSpan("listing_subrepo_packages", st.SubName)
2536-
rErr, err := st.bc.Exec("go/bin/go", buildlet.ExecOpts{
2536+
rErr, err := st.bc.Exec(st.ctx, "go/bin/go", buildlet.ExecOpts{
25372537
Output: &buf,
25382538
Dir: "gopath/src/" + repoPath,
25392539
ExtraEnv: append(st.conf.Env(), "GOROOT="+goroot, "GOPATH="+gopath),
@@ -2580,7 +2580,7 @@ func (st *buildStatus) runSubrepoTests() (remoteErr, err error) {
25802580

25812581
var remoteErrors []error
25822582
for _, tr := range testRuns {
2583-
rErr, err := st.bc.Exec("go/bin/go", buildlet.ExecOpts{
2583+
rErr, err := st.bc.Exec(st.ctx, "go/bin/go", buildlet.ExecOpts{
25842584
Debug: true, // make buildlet print extra debug in output for failures
25852585
Output: st,
25862586
Dir: tr.Dir,
@@ -2610,7 +2610,7 @@ func (st *buildStatus) runSubrepoTests() (remoteErr, err error) {
26102610
// It uses module-specific environment variables from st.conf.ModulesEnv.
26112611
func (st *buildStatus) goMod(importPath, goroot, gopath string) (string, error) {
26122612
var buf bytes.Buffer
2613-
rErr, err := st.bc.Exec("go/bin/go", buildlet.ExecOpts{
2613+
rErr, err := st.bc.Exec(st.ctx, "go/bin/go", buildlet.ExecOpts{
26142614
Output: &buf,
26152615
Dir: "gopath/src/" + importPath,
26162616
ExtraEnv: append(append(st.conf.Env(), "GOROOT="+goroot, "GOPATH="+gopath), st.conf.ModulesEnv(st.SubName)...),
@@ -2653,7 +2653,7 @@ func (st *buildStatus) fetchDependenciesToGOPATHWorkspace(goroot, gopath string)
26532653
findDeps := func(repo string) (rErr, err error) {
26542654
repoPath := importPathOfRepo(repo)
26552655
var buf bytes.Buffer
2656-
rErr, err = st.bc.Exec("go/bin/go", buildlet.ExecOpts{
2656+
rErr, err = st.bc.Exec(st.ctx, "go/bin/go", buildlet.ExecOpts{
26572657
Output: &buf,
26582658
Dir: "gopath/src/" + repoPath,
26592659
ExtraEnv: append(st.conf.Env(), "GOROOT="+goroot, "GOPATH="+gopath),
@@ -3138,12 +3138,16 @@ func (st *buildStatus) runTestsOnBuildlet(bc *buildlet.Client, tis []*testItem,
31383138
var buf bytes.Buffer
31393139
t0 := time.Now()
31403140
timeout := st.conf.DistTestsExecTimeout(names)
3141+
3142+
ctx, cancel := context.WithTimeout(st.ctx, timeout)
3143+
defer cancel()
3144+
31413145
var remoteErr, err error
31423146
if ti := tis[0]; ti.bench != nil {
31433147
pbr, perr := st.parentRev()
31443148
// TODO(quentin): Error if parent commit could not be determined?
31453149
if perr == nil {
3146-
remoteErr, err = ti.bench.Run(buildEnv, st, st.conf, bc, &buf, []buildgo.BuilderRev{st.BuilderRev, pbr})
3150+
remoteErr, err = ti.bench.Run(st.ctx, buildEnv, st, st.conf, bc, &buf, []buildgo.BuilderRev{st.BuilderRev, pbr})
31473151
}
31483152
} else {
31493153
env := append(st.conf.Env(),
@@ -3153,7 +3157,7 @@ func (st *buildStatus) runTestsOnBuildlet(bc *buildlet.Client, tis []*testItem,
31533157
)
31543158
env = append(env, st.conf.ModulesEnv("go")...)
31553159

3156-
remoteErr, err = bc.Exec("go/bin/go", buildlet.ExecOpts{
3160+
remoteErr, err = bc.Exec(ctx, "go/bin/go", buildlet.ExecOpts{
31573161
// We set Dir to "." instead of the default ("go/bin") so when the dist tests
31583162
// try to run os/exec.Command("go", "test", ...), the LookPath of "go" doesn't
31593163
// return "./go.exe" (which exists in the current directory: "go/bin") and then
@@ -3163,7 +3167,6 @@ func (st *buildStatus) runTestsOnBuildlet(bc *buildlet.Client, tis []*testItem,
31633167
Dir: ".",
31643168
Output: &buf, // see "maybe stream lines" TODO below
31653169
ExtraEnv: env,
3166-
Timeout: timeout,
31673170
Path: []string{"$WORKDIR/go/bin", "$PATH"},
31683171
Args: args,
31693172
})

cmd/debugnewvm/debugnewvm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ func main() {
128128
log.Printf("WorkDir: %v, %v", dir, err)
129129

130130
if *sleepSec > 0 {
131-
bc.Exec("sysctl", buildlet.ExecOpts{
131+
bc.Exec(ctx, "sysctl", buildlet.ExecOpts{
132132
Output: os.Stdout,
133133
SystemLevel: true,
134134
Args: []string{"kern.timecounter.hardware"},
135135
})
136-
bc.Exec("bash", buildlet.ExecOpts{
136+
bc.Exec(ctx, "bash", buildlet.ExecOpts{
137137
Output: os.Stdout,
138138
SystemLevel: true,
139139
Args: []string{"-c", "rdate -p -v time.nist.gov; sleep " + fmt.Sprint(*sleepSec) + "; rdate -p -v time.nist.gov"},
@@ -172,7 +172,7 @@ func main() {
172172
}
173173
t0 := time.Now()
174174
log.Printf("Running %s ...", script)
175-
remoteErr, err := bc.Exec(path.Join("go", script), buildlet.ExecOpts{
175+
remoteErr, err := bc.Exec(ctx, path.Join("go", script), buildlet.ExecOpts{
176176
Output: os.Stdout,
177177
ExtraEnv: bconf.Env(),
178178
Debug: true,

cmd/gomote/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package main
66

77
import (
8+
"context"
89
"flag"
910
"fmt"
1011
"os"
@@ -71,7 +72,7 @@ func run(args []string) error {
7172
}
7273
env = append(env, "GO_DISABLE_OUTBOUND_NETWORK="+fmt.Sprint(firewall))
7374

74-
remoteErr, execErr := bc.Exec(cmd, buildlet.ExecOpts{
75+
remoteErr, execErr := bc.Exec(context.Background(), cmd, buildlet.ExecOpts{
7576
Dir: dir,
7677
SystemLevel: sys || strings.HasPrefix(cmd, "/"),
7778
Output: os.Stdout,

cmd/perfrun/perfrun.go

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

1010
import (
1111
"bytes"
12+
"context"
1213
"encoding/json"
1314
"flag"
1415
"fmt"
@@ -58,7 +59,7 @@ func runBench(out io.Writer, bench, src string, commits []string) error {
5859
// Build binaries
5960
log.Printf("Building bench binary for rev %s", rev)
6061
var buf bytes.Buffer
61-
remoteErr, err := bc.Exec(path.Join(dir, "bin", "go"), buildlet.ExecOpts{
62+
remoteErr, err := bc.Exec(context.Background(), path.Join(dir, "bin", "go"), buildlet.ExecOpts{
6263
Output: &buf,
6364
ExtraEnv: []string{"GOROOT=" + path.Join(workDir, dir)},
6465
Args: []string{"test", "-c"},
@@ -81,7 +82,7 @@ func runBench(out io.Writer, bench, src string, commits []string) error {
8182
log.Printf("Starting bench run %d", i)
8283
for _, rev := range commits {
8384
var buf bytes.Buffer
84-
remoteErr, err := bc.Exec(path.Join("go-"+rev, "test/bench/go1/go1.test"), buildlet.ExecOpts{
85+
remoteErr, err := bc.Exec(context.Background(), path.Join("go-"+rev, "test/bench/go1/go1.test"), buildlet.ExecOpts{
8586
Output: &buf,
8687
Args: []string{"-test.bench", ".", "-test.benchmem"},
8788
})

cmd/release/release.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (b *Build) make() error {
366366
if *watch && *target != "" {
367367
execOut = io.MultiWriter(out, os.Stdout)
368368
}
369-
remoteErr, err := client.Exec(filepath.Join(goDir, bc.MakeScript()), buildlet.ExecOpts{
369+
remoteErr, err := client.Exec(context.Background(), filepath.Join(goDir, bc.MakeScript()), buildlet.ExecOpts{
370370
Output: execOut,
371371
ExtraEnv: env,
372372
Args: bc.MakeScriptArgs(),
@@ -396,7 +396,7 @@ func (b *Build) make() error {
396396
if len(args) > 0 && args[0] == "run" && hostArch != "" {
397397
cmdEnv = setGOARCH(cmdEnv, hostArch)
398398
}
399-
remoteErr, err := client.Exec(goCmd, buildlet.ExecOpts{
399+
remoteErr, err := client.Exec(context.Background(), goCmd, buildlet.ExecOpts{
400400
Output: execOut,
401401
Dir: ".", // root of buildlet work directory
402402
Args: args,
@@ -595,7 +595,7 @@ func (b *Build) make() error {
595595
if *watch && *target != "" {
596596
execOut = io.MultiWriter(out, os.Stdout)
597597
}
598-
remoteErr, err := client.Exec(filepath.Join(goDir, bc.AllScript()), buildlet.ExecOpts{
598+
remoteErr, err := client.Exec(context.Background(), filepath.Join(goDir, bc.AllScript()), buildlet.ExecOpts{
599599
Output: execOut,
600600
ExtraEnv: env,
601601
Args: bc.AllScriptArgs(),
@@ -814,7 +814,7 @@ func (b *Build) checkRelocations(client *buildlet.Client) error {
814814
}
815815
var out bytes.Buffer
816816
file := fmt.Sprintf("go/pkg/linux_%s/runtime/cgo.a", b.Arch)
817-
remoteErr, err := client.Exec("readelf", buildlet.ExecOpts{
817+
remoteErr, err := client.Exec(context.Background(), "readelf", buildlet.ExecOpts{
818818
Output: &out,
819819
Args: []string{"-r", "--wide", file},
820820
SystemLevel: true, // look for readelf in system's PATH

internal/buildgo/benchmarks.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func buildGo1(conf *dashboard.BuildConfig, bc *buildlet.Client, goroot string, w
5858
if found {
5959
return nil, nil
6060
}
61-
return bc.Exec(path.Join(goroot, "bin", "go"), buildlet.ExecOpts{
61+
return bc.Exec(context.TODO(), path.Join(goroot, "bin", "go"), buildlet.ExecOpts{
6262
Output: w,
6363
ExtraEnv: []string{"GOROOT=" + conf.FilePathJoin(workDir, goroot)},
6464
Args: []string{"test", "-c"},
@@ -72,7 +72,7 @@ func buildPkg(conf *dashboard.BuildConfig, bc *buildlet.Client, goroot string, w
7272
if err != nil {
7373
return nil, err
7474
}
75-
return bc.Exec(path.Join(goroot, "bin", "go"), buildlet.ExecOpts{
75+
return bc.Exec(context.TODO(), path.Join(goroot, "bin", "go"), buildlet.ExecOpts{
7676
Output: w,
7777
ExtraEnv: []string{"GOROOT=" + conf.FilePathJoin(workDir, goroot)},
7878
Args: []string{"test", "-c", "-o", conf.FilePathJoin(workDir, goroot, name), pkg},
@@ -90,7 +90,7 @@ func buildXBenchmark(sl spanlog.Logger, conf *dashboard.BuildConfig, bc *buildle
9090
return nil, err
9191
}
9292
}
93-
return bc.Exec(path.Join(goroot, "bin/go"), buildlet.ExecOpts{
93+
return bc.Exec(context.TODO(), path.Join(goroot, "bin/go"), buildlet.ExecOpts{
9494
Output: w,
9595
ExtraEnv: []string{
9696
"GOROOT=" + conf.FilePathJoin(workDir, goroot),
@@ -134,7 +134,7 @@ func (gb GoBuilder) EnumerateBenchmarks(bc *buildlet.Client, benchmarksRev strin
134134
// Enumerate x/benchmarks
135135
if benchmarksRev != "" {
136136
var buf bytes.Buffer
137-
remoteErr, err := bc.Exec(path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
137+
remoteErr, err := bc.Exec(context.TODO(), path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
138138
Output: &buf,
139139
ExtraEnv: []string{
140140
"GOROOT=" + gb.Conf.FilePathJoin(workDir, gb.Goroot),
@@ -161,7 +161,7 @@ func (gb GoBuilder) EnumerateBenchmarks(bc *buildlet.Client, benchmarksRev strin
161161
if len(pkgs) > 0 {
162162
// Find packages that actually have benchmarks or tests.
163163
var buf bytes.Buffer
164-
remoteErr, err := bc.Exec(path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
164+
remoteErr, err := bc.Exec(context.TODO(), path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
165165
Output: &buf,
166166
ExtraEnv: []string{
167167
"GOROOT=" + gb.Conf.FilePathJoin(workDir, gb.Goroot),
@@ -205,7 +205,7 @@ func runOneBenchBinary(conf *dashboard.BuildConfig, bc *buildlet.Client, w io.Wr
205205
return nil, fmt.Errorf("runOneBenchBinary, WorkDir: %v", err)
206206
}
207207
// Some benchmarks need GOROOT so they can invoke cmd/go.
208-
return bc.Exec(binaryPath, buildlet.ExecOpts{
208+
return bc.Exec(context.TODO(), binaryPath, buildlet.ExecOpts{
209209
Output: w,
210210
Dir: dir,
211211
Args: args,
@@ -226,7 +226,7 @@ func runOneBenchBinary(conf *dashboard.BuildConfig, bc *buildlet.Client, w io.Wr
226226
})
227227
}
228228

229-
func buildRev(buildEnv *buildenv.Environment, sl spanlog.Logger, conf *dashboard.BuildConfig, bc *buildlet.Client, w io.Writer, goroot string, br BuilderRev) error {
229+
func buildRev(ctx context.Context, buildEnv *buildenv.Environment, sl spanlog.Logger, conf *dashboard.BuildConfig, bc *buildlet.Client, w io.Writer, goroot string, br BuilderRev) error {
230230
if br.SnapshotExists(context.TODO(), buildEnv) {
231231
return bc.PutTarFromURL(br.SnapshotURL(buildEnv), goroot)
232232
}
@@ -246,7 +246,7 @@ func buildRev(buildEnv *buildenv.Environment, sl spanlog.Logger, conf *dashboard
246246
Conf: conf,
247247
Goroot: goroot,
248248
}
249-
remoteErr, err := builder.RunMake(bc, w)
249+
remoteErr, err := builder.RunMake(ctx, bc, w)
250250
if err != nil {
251251
return err
252252
}
@@ -257,12 +257,12 @@ func buildRev(buildEnv *buildenv.Environment, sl spanlog.Logger, conf *dashboard
257257
// Build output is sent to w. Benchmark output is stored in b.output.
258258
// revs must contain exactly two revs. The first rev is assumed to be present in "go", and the second will be placed into "go-parent".
259259
// TODO(quentin): Support len(revs) != 2.
260-
func (b *BenchmarkItem) Run(buildEnv *buildenv.Environment, sl spanlog.Logger, conf *dashboard.BuildConfig, bc *buildlet.Client, w io.Writer, revs []BuilderRev) (remoteErr, err error) {
260+
func (b *BenchmarkItem) Run(ctx context.Context, buildEnv *buildenv.Environment, sl spanlog.Logger, conf *dashboard.BuildConfig, bc *buildlet.Client, w io.Writer, revs []BuilderRev) (remoteErr, err error) {
261261
// Ensure we have a built parent repo.
262262
if err := bc.ListDir("go-parent", buildlet.ListDirOpts{}, func(buildlet.DirEntry) {}); err != nil {
263263
pbr := revs[1]
264264
sp := sl.CreateSpan("bench_build_parent", bc.Name())
265-
err = buildRev(buildEnv, sl, conf, bc, w, "go-parent", pbr)
265+
err = buildRev(ctx, buildEnv, sl, conf, bc, w, "go-parent", pbr)
266266
sp.Done(err)
267267
if err != nil {
268268
return nil, err

internal/buildgo/buildgo.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ type GoBuilder struct {
103103
// goroot is relative to the workdir with forward slashes.
104104
// w is the Writer to send build output to.
105105
// remoteErr and err are as described at the top of this file.
106-
func (gb GoBuilder) RunMake(bc *buildlet.Client, w io.Writer) (remoteErr, err error) {
106+
func (gb GoBuilder) RunMake(ctx context.Context, bc *buildlet.Client, w io.Writer) (remoteErr, err error) {
107107
// Build the source code.
108108
makeSpan := gb.CreateSpan("make", gb.Conf.MakeScript())
109-
remoteErr, err = bc.Exec(path.Join(gb.Goroot, gb.Conf.MakeScript()), buildlet.ExecOpts{
109+
remoteErr, err = bc.Exec(ctx, path.Join(gb.Goroot, gb.Conf.MakeScript()), buildlet.ExecOpts{
110110
Output: w,
111111
ExtraEnv: append(gb.Conf.Env(), "GOBIN="),
112112
Debug: true,
@@ -125,7 +125,7 @@ func (gb GoBuilder) RunMake(bc *buildlet.Client, w io.Writer) (remoteErr, err er
125125
// Need to run "go install -race std" before the snapshot + tests.
126126
if pkgs := gb.Conf.GoInstallRacePackages(); len(pkgs) > 0 {
127127
sp := gb.CreateSpan("install_race_std")
128-
remoteErr, err = bc.Exec(path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
128+
remoteErr, err = bc.Exec(ctx, path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
129129
Output: w,
130130
ExtraEnv: append(gb.Conf.Env(), "GOBIN="),
131131
Debug: true,
@@ -143,7 +143,7 @@ func (gb GoBuilder) RunMake(bc *buildlet.Client, w io.Writer) (remoteErr, err er
143143
}
144144

145145
if gb.Name == "linux-amd64-racecompile" {
146-
return gb.runConcurrentGoBuildStdCmd(bc, w)
146+
return gb.runConcurrentGoBuildStdCmd(ctx, bc, w)
147147
}
148148

149149
return nil, nil
@@ -155,9 +155,9 @@ func (gb GoBuilder) RunMake(bc *buildlet.Client, w io.Writer) (remoteErr, err er
155155
// with -gcflags=-c=8 using a race-enabled cmd/compile (built by
156156
// caller, runMake, per builder config).
157157
// The idea is that this might find data races in cmd/compile.
158-
func (gb GoBuilder) runConcurrentGoBuildStdCmd(bc *buildlet.Client, w io.Writer) (remoteErr, err error) {
158+
func (gb GoBuilder) runConcurrentGoBuildStdCmd(ctx context.Context, bc *buildlet.Client, w io.Writer) (remoteErr, err error) {
159159
span := gb.CreateSpan("go_build_c128_std_cmd")
160-
remoteErr, err = bc.Exec(path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
160+
remoteErr, err = bc.Exec(ctx, path.Join(gb.Goroot, "bin/go"), buildlet.ExecOpts{
161161
Output: w,
162162
ExtraEnv: append(gb.Conf.Env(), "GOBIN="),
163163
Debug: true,

0 commit comments

Comments
 (0)