From 57b9709b690930c1eaad47b37a8c562f67ea3b55 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 30 Jan 2025 11:53:28 +0100 Subject: [PATCH] util: replace Walk with WalkDir Closes: https://github.com/containers/podman/issues/25163 Signed-off-by: Giuseppe Scrivano --- cmd/podman/common/completion.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go index 3476f33be8..d4a8058bc7 100644 --- a/cmd/podman/common/completion.go +++ b/cmd/podman/common/completion.go @@ -3,6 +3,7 @@ package common import ( "bufio" "fmt" + "io/fs" "os" "path" "path/filepath" @@ -1646,8 +1647,8 @@ func AutocompleteContainersConfModules(cmd *cobra.Command, args []string, toComp for _, d := range dirs { cleanedD := filepath.Clean(d) moduleD := cleanedD + string(os.PathSeparator) - _ = filepath.Walk(d, - func(path string, f os.FileInfo, err error) error { + _ = filepath.WalkDir(d, + func(path string, d fs.DirEntry, err error) error { if err != nil { return err } @@ -1657,7 +1658,7 @@ func AutocompleteContainersConfModules(cmd *cobra.Command, args []string, toComp return nil } - if filepath.Clean(path) == cleanedD || f.IsDir() { + if filepath.Clean(path) == cleanedD || d.IsDir() { return nil }