KEMBAR78
refactor: use `os.ReadDir` for lightweight directory reading by Juneezee · Pull Request #148 · github/freno · GitHub
Skip to content

Conversation

@Juneezee
Copy link
Contributor

os.ReadDir is a more efficient than ioutil.ReadDir as stated here https://pkg.go.dev/io/ioutil#ReadDir. Since we are only using IsDir() and Name() in getSnapshots, we don't need to read the directory with full stat information using ioutil.ReadDir.

`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>
@timvaillancourt
Copy link
Contributor

timvaillancourt commented Jan 20, 2022

@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>
@Juneezee
Copy link
Contributor Author

@timvaillancourt Done 😃

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @Juneezee, this looks good!

@ghost ghost temporarily deployed to staging March 1, 2022 17:17 Inactive
@ghost ghost temporarily deployed to staging March 1, 2022 17:31 Inactive
@ghost
Copy link

ghost commented Mar 1, 2022

Deployed to staging internally to test.

@ghost ghost temporarily deployed to production March 8, 2022 11:07 Inactive
@ghost
Copy link

ghost commented Mar 8, 2022

Deployed successfully to production 👍

@ghost ghost merged commit ca98a19 into github:master Mar 8, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants