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

os: example shows deprecated function #46976

Closed
eliben opened this issue Jun 29, 2021 · 3 comments
Closed

os: example shows deprecated function #46976

eliben opened this issue Jun 29, 2021 · 3 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@eliben
Copy link
Member

eliben commented Jun 29, 2021

This is a documentation issue.

One of the examples in the os packages shows the usage of the IsNotExist function; however, this function's documentation recommends avoiding it in new code:

This function predates errors.Is. It only supports errors returned by the os package. New code should use errors.Is(err, os.ErrNotExist).

It seems like the example should be updated to demonstrate the new way of checking for this error instead.

@gopherbot
Copy link

Change https://golang.org/cl/331692 mentions this issue: os: change example to avoid deprecated function

@ianlancetaylor
Copy link
Contributor

Hi Eli. It's not necessary to open an issue for a documentation fix if you are going to send a patch anyhow. It's OK to just send the patch without an issue. Thanks.

@eliben
Copy link
Member Author

eliben commented Jun 30, 2021

Hi Eli. It's not necessary to open an issue for a documentation fix if you are going to send a patch anyhow. It's OK to just send the patch without an issue. Thanks.

Thanks Ian, I'll keep this in mind for next time.

@seankhliao seankhliao added Documentation NeedsFix The path to resolution is known, but the work has not been done. labels Jun 30, 2021
eliben added a commit to eliben/go that referenced this issue Jun 30, 2021
The IsNotExist function is deprecated; change package example to avoid
it and use the recommended way instead.

Fixes golang#46976

Change-Id: I3c301d0a89b6bda42184df314ba8418062ca39ee
@dmitshur dmitshur added this to the Go1.17 milestone Jun 30, 2021
@golang golang locked and limited conversation to collaborators Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants