Skip to content

Commit f7f5b1d

Browse files
authored
servegit: use more performant WalkDir (#938)
WalkDir was introduced in go1.16 suits our use case while being more efficient. Test Plan: go test
1 parent f5de12d commit f7f5b1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/servegit/serve.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"encoding/json"
66
"fmt"
77
"html/template"
8+
"io/fs"
89
"log"
910
"net"
1011
"net/http"
11-
"os"
1212
"os/exec"
1313
pathpkg "path"
1414
"path/filepath"
@@ -170,7 +170,7 @@ func (s *Serve) Repos() ([]Repo, error) {
170170
return nil, nil
171171
}
172172

173-
err = filepath.Walk(root, func(path string, fi os.FileInfo, fileErr error) error {
173+
err = filepath.WalkDir(root, func(path string, fi fs.DirEntry, fileErr error) error {
174174
if fileErr != nil {
175175
s.Info.Printf("WARN: ignoring error searching %s: %v", path, fileErr)
176176
return nil

0 commit comments

Comments
 (0)