-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: replace filepath.Walk with filepath.WalkDir #139108
Conversation
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
67e928f
to
74705b0
Compare
Thank you for updating your pull request. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @aa-joshi, @arjunmahishi, @Gofastasf, @golgeek, @kev-cao, @kyle-a-wong, @srosenberg, and @wenyihu6)
pkg/cli/debug_merge_logs.go
line 353 at r1 (raw file):
var files []fileInfo for _, p := range paths { // NB: come go1.16, we should use WalkDir here as it is more efficient.
[nit] remove comment
74705b0
to
454d292
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @aa-joshi, @arjunmahishi, @Gofastasf, @golgeek, @kev-cao, @kyle-a-wong, @srosenberg, and @wenyihu6)
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
07f5741
to
52c519f
Compare
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
@RaduBerinde Hey there seems to be some build issue but its from Github CI deprecated so I don't need to care ? Is this okay to get merged ? This is my first PR :) |
bors r+ |
139108: refactor: replace filepath.Walk with filepath.WalkDir r=RaduBerinde a=Gofastasf Replace filepath.Walk with filepath.WalkDir. filepath.WalkDir, introduced in Go 1.16, is more performant as it avoids creating unnecessary intermediate os.FileInfo objects. While filepath.Walk calls os.Lstat for every file or directory to retrieve os.FileInfo, filepath.WalkDir provides a fs.DirEntry, which includes file type information without requiring a stat call. This change reduces unnecessary system calls and aligns with modern Go practices for directory traversal. Co-authored-by: Gofastasf <[email protected]> Co-authored-by: gofastasf <[email protected]>
Build failed: |
bca1d3f
to
e6a0bce
Compare
Yuo need to apply that patch or run crlfmt (which is our own "stronger" gofmt). |
e6a0bce
to
39739fd
Compare
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. Thank you for updating your pull request. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Sorry, I guess the command line is outdated, we don't want to reformat tons of generated code. Just run |
filepath.WalkDir, introduced in Go 1.16, is more performant as it avoids creating unnecessary intermediate os.FileInfo objects. While filepath.Walk calls os.Lstat for every file or directory to retrieve os.FileInfo, filepath.WalkDir provides a fs.DirEntry, which includes file type information without requiring a stat call. This change reduces unnecessary system calls and aligns with modern Go practices for directory traversal. Epic: None Release note (performance improvement): Improved directory traversal performance by switching from filepath.Walk to filepath.WalkDir. fix: solve the lint error by crlfmt
39739fd
to
f47addb
Compare
@RaduBerinde Fixed the linting error. |
Thanks, let's try again. bors r+ |
Replace filepath.Walk with filepath.WalkDir.
filepath.WalkDir, introduced in Go 1.16, is more performant as it avoids creating unnecessary intermediate os.FileInfo objects. While filepath.Walk calls os.Lstat for every file or directory to retrieve os.FileInfo, filepath.WalkDir provides a fs.DirEntry, which includes file type information without requiring a stat call.
This change reduces unnecessary system calls and aligns with modern Go practices for directory traversal.