aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath/path.go
diff options
context:
space:
mode:
authormstmdev <mstmdev@gmail.com>2023-09-12 11:49:41 +0000
committerGopher Robot <gobot@golang.org>2023-09-12 20:27:28 +0000
commit5f04ef752bc9485821eae8a5b248b9d39d57989c (patch)
tree1a99391f65a5aa162c5ea80a74c13f5c4c92c5a6 /src/path/filepath/path.go
parent2be7b1a4ace278a76ea9d34f8caa9290a249f28a (diff)
downloadgo-5f04ef752bc9485821eae8a5b248b9d39d57989c.tar.xz
io/fs, path/filepath, cmd/gofmt: replace statDirEntry with fs.FileInfoToDirEntry
Change-Id: Ie914367314ca72fab34c4d4529755dea853cf325 GitHub-Last-Rev: bc61665d33d7f15da371dcfb90c132fab25fc233 GitHub-Pull-Request: golang/go#62342 Reviewed-on: https://go-review.googlesource.com/c/go/+/523876 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Diffstat (limited to 'src/path/filepath/path.go')
-rw-r--r--src/path/filepath/path.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
index 41fa733af9..6dcb0e1fb9 100644
--- a/src/path/filepath/path.go
+++ b/src/path/filepath/path.go
@@ -545,7 +545,7 @@ func WalkDir(root string, fn fs.WalkDirFunc) error {
if err != nil {
err = fn(root, nil, err)
} else {
- err = walkDir(root, &statDirEntry{info}, fn)
+ err = walkDir(root, fs.FileInfoToDirEntry(info), fn)
}
if err == SkipDir || err == SkipAll {
return nil
@@ -553,19 +553,6 @@ func WalkDir(root string, fn fs.WalkDirFunc) error {
return err
}
-type statDirEntry struct {
- info fs.FileInfo
-}
-
-func (d *statDirEntry) Name() string { return d.info.Name() }
-func (d *statDirEntry) IsDir() bool { return d.info.IsDir() }
-func (d *statDirEntry) Type() fs.FileMode { return d.info.Mode().Type() }
-func (d *statDirEntry) Info() (fs.FileInfo, error) { return d.info, nil }
-
-func (d *statDirEntry) String() string {
- return fs.FormatDirEntry(d)
-}
-
// Walk walks the file tree rooted at root, calling fn for each file or
// directory in the tree, including root.
//