aboutsummaryrefslogtreecommitdiffstats
path: root/vm/gce
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-07-21 11:51:35 +0200
committerTaras Madan <tarasmadan@google.com>2023-07-24 09:12:13 +0000
commita36fe24b8383f6cd9b3519cd3eabdb9675d8992d (patch)
tree3fef9a57760ccc4013289acd60e94e083db466e6 /vm/gce
parent7549a7e1b57831cf6b08ce4700fc6e53417919f9 (diff)
all: use errors.As instead of .(type)
Diffstat (limited to 'vm/gce')
-rw-r--r--vm/gce/gce.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index 60a88010c..5c91f08de 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -15,6 +15,7 @@ import (
"archive/tar"
"bytes"
"compress/gzip"
+ "errors"
"fmt"
"io"
"os"
@@ -318,14 +319,15 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
ssh.Process.Kill()
merger.Wait()
con.Wait()
+ var mergeError *vmimpl.MergerError
if cmdErr := ssh.Wait(); cmdErr == nil {
// If the command exited successfully, we got EOF error from merger.
// But in this case no error has happened and the EOF is expected.
err = nil
- } else if merr, ok := err.(vmimpl.MergerError); ok && merr.R == conRpipe {
+ } else if errors.As(err, &mergeError) && mergeError.R == conRpipe {
// Console connection must never fail. If it does, it's either
// instance preemption or a GCE bug. In either case, not a kernel bug.
- log.Logf(0, "%v: gce console connection failed with %v", inst.name, merr.Err)
+ log.Logf(0, "%v: gce console connection failed with %v", inst.name, mergeError.Err)
err = vmimpl.ErrTimeout
} else {
// Check if the instance was terminated due to preemption or host maintenance.