mirror of
https://github.com/containers/podman.git
synced 2025-05-19 16:18:51 +08:00
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>
This commit is contained in:
@ -715,9 +715,6 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
||||
}
|
||||
|
||||
p := specgen.NewPodSpecGenerator()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p, err = entities.ToPodSpecGen(*p, &podOpt)
|
||||
if err != nil {
|
||||
@ -1632,7 +1629,7 @@ func getBuildFile(imageName string, cwd string) (string, error) {
|
||||
// If the error is not because the file does not exist, take
|
||||
// a mulligan and try Dockerfile. If that also fails, return that
|
||||
// error
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
logrus.Error(err.Error())
|
||||
}
|
||||
|
||||
@ -1642,7 +1639,7 @@ func getBuildFile(imageName string, cwd string) (string, error) {
|
||||
return dockerfilePath, nil
|
||||
}
|
||||
// Strike two
|
||||
if os.IsNotExist(err) {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return "", nil
|
||||
}
|
||||
return "", err
|
||||
|
Reference in New Issue
Block a user