diff options
| author | Taras Madan <tarasmadan@google.com> | 2023-07-21 11:51:35 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2023-07-24 09:12:13 +0000 |
| commit | a36fe24b8383f6cd9b3519cd3eabdb9675d8992d (patch) | |
| tree | 3fef9a57760ccc4013289acd60e94e083db466e6 /pkg/instance/instance.go | |
| parent | 7549a7e1b57831cf6b08ce4700fc6e53417919f9 (diff) | |
all: use errors.As instead of .(type)
Diffstat (limited to 'pkg/instance/instance.go')
| -rw-r--r-- | pkg/instance/instance.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index ea4084def..7696a945d 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -7,6 +7,7 @@ package instance import ( "encoding/json" + "errors" "fmt" "net" "os" @@ -305,7 +306,8 @@ func (inst *inst) test() EnvTestResult { ret := EnvTestResult{ Error: testErr, } - if bootErr, ok := err.(vm.BootErrorer); ok { + var bootErr vm.BootErrorer + if errors.As(err, &bootErr) { testErr.Title, testErr.Output = bootErr.BootError() ret.RawOutput = testErr.Output rep := inst.reporter.Parse(testErr.Output) @@ -327,7 +329,8 @@ func (inst *inst) test() EnvTestResult { testErr.Title = rep.Title } else { testErr.Infra = true - if infraErr, ok := err.(vm.InfraErrorer); ok { + var infraErr vm.InfraErrorer + if errors.As(err, &infraErr) { // In case there's more info available. testErr.Title, testErr.Output = infraErr.InfraError() } |
