diff --git a/internal/cmd/diag.go b/internal/cmd/diag.go index c838d834e3..960459c3d7 100644 --- a/internal/cmd/diag.go +++ b/internal/cmd/diag.go @@ -59,7 +59,7 @@ func ExecInShimHost(ctx context.Context, req *CmdProcessRequest) (int, error) { cmd.Stderr = np.Stderr() err = cmd.Run() if err != nil { - if exiterr, ok := err.(*exec.ExitError); ok { //nolint:errorlint + if exiterr := (&exec.ExitError{}); errors.As(err, &exiterr) { return exiterr.ExitCode(), exiterr } return -1, err diff --git a/internal/lcow/common.go b/internal/lcow/common.go index c13bd35481..9e205076a5 100644 --- a/internal/lcow/common.go +++ b/internal/lcow/common.go @@ -5,6 +5,7 @@ package lcow import ( "bytes" "context" + "errors" "fmt" "time" @@ -28,7 +29,7 @@ func formatDiskUvm(ctx context.Context, lcowUVM *uvm.UtilityVM, controller int, if err == nil { break } - if _, ok := err.(*cmdpkg.ExitError); !ok { //nolint:errorlint + if e := (&cmdpkg.ExitError{}); !errors.As(err, &e) { return fmt.Errorf("failed to run %+v following hot-add %s to utility VM: %w", cmd.Spec.Args, destPath, err) } time.Sleep(time.Millisecond * 10) diff --git a/internal/lcow/scratch.go b/internal/lcow/scratch.go index cab8b0470a..2e78de4e83 100644 --- a/internal/lcow/scratch.go +++ b/internal/lcow/scratch.go @@ -101,7 +101,7 @@ func CreateScratch(ctx context.Context, lcowUVM *uvm.UtilityVM, destFile string, if err == nil { break } - if _, ok := err.(*cmdpkg.ExitError); !ok { //nolint:errorlint + if e := (&cmdpkg.ExitError{}); !errors.As(err, &e) { return fmt.Errorf("failed to run %+v following hot-add %s to utility VM: %w", cmd.Spec.Args, destFile, err) } time.Sleep(time.Millisecond * 10)