Skip to content

Commit 518773a

Browse files
committed
pkg/domain/infra/abi/play.go: fix two nilness issues
The first condition is checking an error where no error is returned and the second is checking even though err == nil was matched above already so we know the error is not nil here. Then also replace os.IsNotExist(err) with errors.Is(err, os.ErrNotExist) as that should be used for new code. This should not change behavior in any way. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent 04e8cd1 commit 518773a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pkg/domain/infra/abi/play.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,6 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
715715
}
716716

717717
p := specgen.NewPodSpecGenerator()
718-
if err != nil {
719-
return nil, nil, err
720-
}
721718

722719
p, err = entities.ToPodSpecGen(*p, &podOpt)
723720
if err != nil {
@@ -1632,7 +1629,7 @@ func getBuildFile(imageName string, cwd string) (string, error) {
16321629
// If the error is not because the file does not exist, take
16331630
// a mulligan and try Dockerfile. If that also fails, return that
16341631
// error
1635-
if err != nil && !os.IsNotExist(err) {
1632+
if !errors.Is(err, os.ErrNotExist) {
16361633
logrus.Error(err.Error())
16371634
}
16381635

@@ -1642,7 +1639,7 @@ func getBuildFile(imageName string, cwd string) (string, error) {
16421639
return dockerfilePath, nil
16431640
}
16441641
// Strike two
1645-
if os.IsNotExist(err) {
1642+
if errors.Is(err, os.ErrNotExist) {
16461643
return "", nil
16471644
}
16481645
return "", err

0 commit comments

Comments
 (0)