diff options
author | Eng Zer Jun <engzerjun@gmail.com> | 2022-09-11 15:58:31 +0800 |
---|---|---|
committer | Eng Zer Jun <engzerjun@gmail.com> | 2022-09-11 15:58:31 +0800 |
commit | 118546c6a70704a7b19cb99f3c948b28264628de (patch) | |
tree | 5eb092820335de6860d5b5304a2a3e02f8125d03 /pkg/api | |
parent | b9cbc0c09a68be7bb55048a494753c77c08bfbd3 (diff) | |
download | podman-118546c6a70704a7b19cb99f3c948b28264628de.tar.gz podman-118546c6a70704a7b19cb99f3c948b28264628de.tar.bz2 podman-118546c6a70704a7b19cb99f3c948b28264628de.zip |
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>
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/compat/info.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/info.go b/pkg/api/handlers/compat/info.go index d82513284..60bbd40fe 100644 --- a/pkg/api/handlers/compat/info.go +++ b/pkg/api/handlers/compat/info.go @@ -2,7 +2,6 @@ package compat import ( "fmt" - "io/ioutil" "net/http" "os" goRuntime "runtime" @@ -198,7 +197,7 @@ func getRuntimes(configInfo *config.Config) map[string]docker.Runtime { func getFdCount() (count int) { count = -1 - if entries, err := ioutil.ReadDir("/proc/self/fd"); err == nil { + if entries, err := os.ReadDir("/proc/self/fd"); err == nil { count = len(entries) } return |