mirror of
https://github.com/golang/go.git
synced 2025-10-30 08:10:58 +00:00
all: update to use filepath.WalkDir instead of filepath.Walk
Now that filepath.WalkDir is available, it is more efficient and should be used in place of filepath.Walk. Update the tree to reflect best practices. As usual, the code compiled with Go 1.4 during bootstrap is excluded. (In this CL, that's only cmd/dist.) For #42027. Change-Id: Ib0f7b1e43e50b789052f9835a63ced701d8c411c Reviewed-on: https://go-review.googlesource.com/c/go/+/267719 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
0433845ad1
commit
c32140fa94
17 changed files with 65 additions and 45 deletions
|
|
@ -503,7 +503,7 @@ func makeText(name string) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
case "go":
|
||||
err := filepath.Walk("../..", func(path string, info fs.FileInfo, err error) error {
|
||||
err := filepath.WalkDir("../..", func(path string, info fs.DirEntry, err error) error {
|
||||
if err == nil && strings.HasSuffix(path, ".go") && !info.IsDir() {
|
||||
file, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue