grim/hgkeeper

Use WalkDir as it is more efficient

13 months ago, aklitzing
7351a2dcdf60
Parents 4a8207ba4501
Children 07d2669c823b
Use WalkDir as it is more efficient

WalkDir was introduced in Go 1.16

Reviewed at https://reviews.imfreedom.org/r/2415/
--- a/access/hgweb.go Fri Mar 31 16:55:53 2023 -0500
+++ b/access/hgweb.go Sat Apr 01 22:49:52 2023 -0500
@@ -24,14 +24,14 @@
// walk the reposPath, looking for .hg directories, when one is found,
// check if it is publicly readable, and if so, add it to the config file.
- filepath.Walk(absReposPath, func(filename string, info os.FileInfo, err error) error {
+ filepath.WalkDir(absReposPath, func(filename string, entry os.DirEntry, err error) error {
// check if we're looking at a directory
- if !info.IsDir() {
+ if !entry.IsDir() {
return nil
}
// check if it is a .hg directory
- if !strings.HasSuffix(info.Name(), ".hg") {
+ if !strings.HasSuffix(entry.Name(), ".hg") {
return nil
}