Skip to content
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: use os.ReadDir for lightweight directory reading #9282

Merged
merged 1 commit into from
Sep 15, 2022
Merged

refactor: use os.ReadDir for lightweight directory reading #9282

merged 1 commit into from
Sep 15, 2022

Conversation

Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Sep 9, 2022

Related Issues

ioutil.ReadDir has been deprecated in Go 1.16. The new os.ReadDir is a more efficient implementation than ioutil.ReadDir.

The full proposal can be read here: https://github.com/golang/go/issues/41467

Proposed Changes

  1. Replaces ioutil.ReadDir with os.ReadDir.

Additional Info

https://pkg.go.dev/io/ioutil#ReadDir

Checklist

Before you mark the PR ready for review, please make sure that:

  • All commits have a clear commit message.
  • The PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

`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`.

Reference: https://pkg.go.dev/io/ioutil#ReadDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@Juneezee Juneezee requested a review from a team as a code owner September 9, 2022 11:57
Copy link
Contributor

@magik6k magik6k 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 the PR!

@magik6k magik6k merged commit 7a2a069 into filecoin-project:master Sep 15, 2022
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