Skip to content

Commit 1f33b5b

Browse files
ijessen-mitllaler9
andauthored
playback: improve performance (#4152)
* change from filepath.Walk to filepath.WalkDir * use filepath.WalkDir in the entire project --------- Co-authored-by: aler9 <[email protected]>
1 parent 116f275 commit 1f33b5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/recordstore/segment.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func fixedPathHasSegments(pathConf *conf.Path) bool {
3434

3535
commonPath := CommonPath(recordPath)
3636

37-
err := filepath.Walk(commonPath, func(fpath string, info fs.FileInfo, err error) error {
37+
err := filepath.WalkDir(commonPath, func(fpath string, info fs.DirEntry, err error) error {
3838
if err != nil {
3939
return err
4040
}
@@ -70,7 +70,7 @@ func regexpPathFindPathsWithSegments(pathConf *conf.Path) map[string]struct{} {
7070

7171
ret := make(map[string]struct{})
7272

73-
filepath.Walk(commonPath, func(fpath string, info fs.FileInfo, err error) error { //nolint:errcheck
73+
filepath.WalkDir(commonPath, func(fpath string, info fs.DirEntry, err error) error { //nolint:errcheck
7474
if err != nil {
7575
return err
7676
}
@@ -136,7 +136,7 @@ func FindSegments(
136136
commonPath := CommonPath(recordPath)
137137
var segments []*Segment
138138

139-
err := filepath.Walk(commonPath, func(fpath string, info fs.FileInfo, err error) error {
139+
err := filepath.WalkDir(commonPath, func(fpath string, info fs.DirEntry, err error) error {
140140
if err != nil {
141141
return err
142142
}

0 commit comments

Comments
 (0)