Skip to content

Commit 7c529ff

Browse files
committed
x/tools: assume go1.22 and simplify
This CL does not include simplifications to gopls. Updates golang/go#65917 Updates golang/go#69095 Change-Id: I2b54992681e2c671324e22668d8401962a1d2363 Reviewed-on: https://go-review.googlesource.com/c/tools/+/593683 Reviewed-by: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 728dbb2 commit 7c529ff

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

internal/gocommand/invoke.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"os"
1717
"os/exec"
1818
"path/filepath"
19-
"reflect"
2019
"regexp"
2120
"runtime"
2221
"strconv"
@@ -250,16 +249,13 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
250249
cmd.Stdout = stdout
251250
cmd.Stderr = stderr
252251

253-
// cmd.WaitDelay was added only in go1.20 (see #50436).
254-
if waitDelay := reflect.ValueOf(cmd).Elem().FieldByName("WaitDelay"); waitDelay.IsValid() {
255-
// https://go.dev/issue/59541: don't wait forever copying stderr
256-
// after the command has exited.
257-
// After CL 484741 we copy stdout manually, so we we'll stop reading that as
258-
// soon as ctx is done. However, we also don't want to wait around forever
259-
// for stderr. Give a much-longer-than-reasonable delay and then assume that
260-
// something has wedged in the kernel or runtime.
261-
waitDelay.Set(reflect.ValueOf(30 * time.Second))
262-
}
252+
// https://go.dev/issue/59541: don't wait forever copying stderr
253+
// after the command has exited.
254+
// After CL 484741 we copy stdout manually, so we we'll stop reading that as
255+
// soon as ctx is done. However, we also don't want to wait around forever
256+
// for stderr. Give a much-longer-than-reasonable delay and then assume that
257+
// something has wedged in the kernel or runtime.
258+
cmd.WaitDelay = 30 * time.Second
263259

264260
// The cwd gets resolved to the real path. On Darwin, where
265261
// /tmp is a symlink, this breaks anything that expects the

0 commit comments

Comments
 (0)