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

Update doc to use fs.ErrNotExist #115

Merged
merged 1 commit into from May 26, 2022
Merged

Conversation

manugupt1
Copy link
Contributor

@manugupt1 manugupt1 commented Apr 26, 2022

There are two nits:

  1. Since go 1.18, the doc recommends errors.Is(err, fs.ErrNotExist) rather than errors.Is(err, os.ErrNotExist); hence the doc update.

mountinfo/mounted_unix.go Outdated Show resolved Hide resolved
@@ -15,7 +15,7 @@ import (
//
// If a non-existent path is specified, an appropriate error is returned.
// In case the caller is not interested in this particular error, it should
// be handled separately using e.g. errors.Is(err, os.ErrNotExist).
// be handled separately using e.g. errors.Is(err, fs.ErrNotExist).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is os.ErrNotExist deprecated yet? If not, it does not make sense to change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not deprecated; but its recommended for new code to use errors.Is(err, fs.ErrNotExist).
Ref: https://pkg.go.dev/os#ErrNotExist

If it does not make sense, I can close this PR. Thank you for taking the time to review.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense, thanks!

Signed-off-by: Manu Gupta <manugupt1@gmail.com>
@kolyshkin kolyshkin changed the title Minor nits: related to error handling and doc Update doc to use fs.ErrNotExist May 24, 2022
@kolyshkin
Copy link
Collaborator

@thaJeztah PTAL

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

in practice I often use the "os" variant (its just an alias of "fs" now, but saves adding another import ☺️)

@thaJeztah thaJeztah merged commit ad57f78 into moby:main May 26, 2022
@manugupt1 manugupt1 deleted the minor-nits branch May 27, 2022 02:13
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.

None yet

3 participants