mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
util: replace Walk with WalkDir
Closes: https://github.com/containers/podman/issues/25163 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:

committed by
Matt Heon

parent
bc5de3dfc7
commit
57b9709b69
@ -3,6 +3,7 @@ package common
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -1646,8 +1647,8 @@ func AutocompleteContainersConfModules(cmd *cobra.Command, args []string, toComp
|
|||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
cleanedD := filepath.Clean(d)
|
cleanedD := filepath.Clean(d)
|
||||||
moduleD := cleanedD + string(os.PathSeparator)
|
moduleD := cleanedD + string(os.PathSeparator)
|
||||||
_ = filepath.Walk(d,
|
_ = filepath.WalkDir(d,
|
||||||
func(path string, f os.FileInfo, err error) error {
|
func(path string, d fs.DirEntry, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1657,7 +1658,7 @@ func AutocompleteContainersConfModules(cmd *cobra.Command, args []string, toComp
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if filepath.Clean(path) == cleanedD || f.IsDir() {
|
if filepath.Clean(path) == cleanedD || d.IsDir() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user