aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec
diff options
context:
space:
mode:
authorJulien Cretel <jub0bsinthecloud@gmail.com>2025-10-01 20:08:18 +0000
committerGopher Robot <gobot@golang.org>2025-10-13 10:12:48 -0700
commit6bcd97d9f4386528aa85eb3cc27da0ed902de870 (patch)
tree54acec806440b95e7afc493d42b0b095fdaee1a5 /src/os/exec
parent1cd71689f2ed8f07031a0cc58fc3586ca501839f (diff)
downloadgo-6bcd97d9f4386528aa85eb3cc27da0ed902de870.tar.xz
all: replace calls to errors.As with errors.AsType
This change replaces most occurrences (in code as well as in comments) of errors.As with errors.AsType. It leaves the errors package and vendored code untouched. Change-Id: I3bde73f318a0b408bdb8f5a251494af15a13118a GitHub-Last-Rev: 8aaaa36a5a12d2a6a90c6d51680464e1a3115139 GitHub-Pull-Request: golang/go#75698 Reviewed-on: https://go-review.googlesource.com/c/go/+/708495 Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/os/exec')
-rw-r--r--src/os/exec/exec_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index 3bded3dea6..1decebdc22 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -1378,8 +1378,8 @@ func TestWaitInterrupt(t *testing.T) {
// The child process should be reported as failed,
// and the grandchild will exit (or die by SIGPIPE) once the
// stderr pipe is closed.
- if ee := new(*exec.ExitError); !errors.As(err, ee) {
- t.Errorf("Wait error = %v; want %T", err, *ee)
+ if ee, ok := errors.AsType[*exec.ExitError](err); !ok {
+ t.Errorf("Wait error = %v; want %T", err, ee)
}
})
@@ -1423,8 +1423,8 @@ func TestWaitInterrupt(t *testing.T) {
// This command ignores SIGINT, sleeping until it is killed.
// Wait should return the usual error for a killed process.
- if ee := new(*exec.ExitError); !errors.As(err, ee) {
- t.Errorf("Wait error = %v; want %T", err, *ee)
+ if ee, ok := errors.AsType[*exec.ExitError](err); !ok {
+ t.Errorf("Wait error = %v; want %T", err, ee)
}
})
@@ -1471,7 +1471,7 @@ func TestWaitInterrupt(t *testing.T) {
t.Logf("stderr:\n%s", cmd.Stderr)
t.Logf("[%d] %v", cmd.Process.Pid, err)
- if ee := new(*exec.ExitError); !errors.As(err, ee) {
+ if _, ok := errors.AsType[*exec.ExitError](err); !ok {
t.Errorf("Wait error = %v; want %v", err, ctx.Err())
}