aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-12 06:50:48 +0200
committerGitHub <noreply@github.com>2022-09-12 06:50:48 +0200
commit1635fe8620fa454647cf7db2af9ed0c9b52eacfb (patch)
tree814768e6b942e199a6974e2f60a7082a004def18 /libpod
parent940d3d889221e21cc24705381b2c2d11d75f39bf (diff)
parent118546c6a70704a7b19cb99f3c948b28264628de (diff)
downloadpodman-1635fe8620fa454647cf7db2af9ed0c9b52eacfb.tar.gz
podman-1635fe8620fa454647cf7db2af9ed0c9b52eacfb.tar.bz2
podman-1635fe8620fa454647cf7db2af9ed0c9b52eacfb.zip
Merge pull request #15737 from Juneezee/refactor/os.ReadDir
refactor: use `os.ReadDir` for lightweight directory reading
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go4
-rw-r--r--libpod/lock/file/file_lock.go3
2 files changed, 3 insertions, 4 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 32674235a..227bb7f1f 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1671,7 +1671,7 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
// a bizarre issue where something copier.Get will ENOENT on
// empty directories and sometimes it will not.
// RHBZ#1928643
- srcContents, err := ioutil.ReadDir(srcDir)
+ srcContents, err := os.ReadDir(srcDir)
if err != nil {
return nil, fmt.Errorf("error reading contents of source directory for copy up into volume %s: %w", vol.Name(), err)
}
@@ -1681,7 +1681,7 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
// If the volume is not empty, we should not copy up.
volMount := vol.mountPoint()
- contents, err := ioutil.ReadDir(volMount)
+ contents, err := os.ReadDir(volMount)
if err != nil {
return nil, fmt.Errorf("error listing contents of volume %s mountpoint when copying up from container %s: %w", vol.Name(), c.ID(), err)
}
diff --git a/libpod/lock/file/file_lock.go b/libpod/lock/file/file_lock.go
index 1379e690a..55110fc0b 100644
--- a/libpod/lock/file/file_lock.go
+++ b/libpod/lock/file/file_lock.go
@@ -2,7 +2,6 @@ package file
import (
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -129,7 +128,7 @@ func (locks *FileLocks) DeallocateAllLocks() error {
if !locks.valid {
return fmt.Errorf("locks have already been closed: %w", syscall.EINVAL)
}
- files, err := ioutil.ReadDir(locks.lockPath)
+ files, err := os.ReadDir(locks.lockPath)
if err != nil {
return fmt.Errorf("error reading directory %s: %w", locks.lockPath, err)
}