mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
refactor: use os.ReadDir
for lightweight directory reading
`os.ReadDir` was added in Go 1.16 as part of the deprecation of `ioutil` package. It is a more efficient implementation than `ioutil.ReadDir`. Reference: https://pkg.go.dev/io/ioutil#ReadDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user