Skip to content

os.ReadDir 替换 Readdir(-1) #6447

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

Merged
merged 1 commit into from
Nov 1, 2022
Merged

os.ReadDir 替换 Readdir(-1) #6447

merged 1 commit into from
Nov 1, 2022

Conversation

Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Nov 1, 2022

下面这段代码

dir, err := os.Open(dirname)
if err != nil {
	return err
}
defer dir.Close()

dirs, err := dir.Readdir(-1)

可以简化成 os.ReadDir(dirname).

  • Please commit to the dev branch 请提交到 dev 开发分支

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
下面这段代码
	dir, err := os.Open(dirname)
	if err != nil {
		return err
	}
	defer dir.Close()

	dirs, err := dir.Readdir(-1)

可以简化成 `os.ReadDir(dirname)`.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@88250 88250 added the Refactor label Nov 1, 2022
@88250 88250 merged commit b1b4e35 into siyuan-note:dev Nov 1, 2022
@88250 88250 added this to the 2.4.9 milestone Nov 1, 2022
@aptexd
Copy link

aptexd commented Nov 2, 2022

少了具体的日志,这样真的好么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants