summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-03-26 06:39:11 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2022-03-27 07:18:25 -0400
commitd106b294b428fbb10f59d4cafe72c3dcaa4e73bb (patch)
tree3c81aa0b8452565c704629258643eb6c51b82b3e /pkg/specgen/generate
parent56b2937f87bd67b46aa93109aefc08ce0edb5cf1 (diff)
downloadpodman-d106b294b428fbb10f59d4cafe72c3dcaa4e73bb.tar.gz
podman-d106b294b428fbb10f59d4cafe72c3dcaa4e73bb.tar.bz2
podman-d106b294b428fbb10f59d4cafe72c3dcaa4e73bb.zip
Switch all calls to filepath.Walk to filepath.WalkDir
WalkDir should be faster the Walk, since we often do not need to stat files. [NO NEW TESTS NEEDED] Existing tests should find errors. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r--pkg/specgen/generate/config_linux.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go
index 35d7f0252..8f83fc09b 100644
--- a/pkg/specgen/generate/config_linux.go
+++ b/pkg/specgen/generate/config_linux.go
@@ -2,6 +2,7 @@ package generate
import (
"fmt"
+ "io/fs"
"io/ioutil"
"os"
"path"
@@ -101,8 +102,8 @@ func DevicesFromPath(g *generate.Generator, devicePath string) error {
}
// mount the internal devices recursively
- if err := filepath.Walk(resolvedDevicePath, func(dpath string, f os.FileInfo, e error) error {
- if f.Mode()&os.ModeDevice == os.ModeDevice {
+ if err := filepath.WalkDir(resolvedDevicePath, func(dpath string, d fs.DirEntry, e error) error {
+ if d.Type()&os.ModeDevice == os.ModeDevice {
found = true
device := fmt.Sprintf("%s:%s", dpath, filepath.Join(dest, strings.TrimPrefix(dpath, src)))
if devmode != "" {