refactor: use os.ReadDir for lightweight directory reading#148
Merged
2 commits merged intogithub:masterfrom Mar 8, 2022
Juneezee:refactor/os.ReadDir
Merged
refactor: use os.ReadDir for lightweight directory reading#1482 commits merged intogithub:masterfrom Juneezee:refactor/os.ReadDir
os.ReadDir for lightweight directory reading#1482 commits merged intogithub:masterfrom
Juneezee:refactor/os.ReadDir
Conversation
`os.ReadDir` was added in Go 1.16 as part of the deprecation of `ioutil` package. It is a more efficient implementation than `ioutil.ReadDir` as stated here https://pkg.go.dev/io/ioutil#ReadDir. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Contributor
|
@Juneezee good point 👍 For this to work the project will require Golang 1.16 or higher, which seems reasonable to me. Could you please update https://github.com/github/freno/blob/master/script/bootstrap to reflect the need for 1.16+? cc @rashiq / @dm-2 |
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Contributor
Author
|
@timvaillancourt Done 😃 |
|
Deployed to staging internally to test. |
|
Deployed successfully to production 👍 |
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
os.ReadDiris a more efficient thanioutil.ReadDiras stated here https://pkg.go.dev/io/ioutil#ReadDir. Since we are only usingIsDir()andName()ingetSnapshots, we don't need to read the directory with full stat information usingioutil.ReadDir.