Skip to content

os: update examples to use errors.Is instead of deprecated functions#77645

Open
kovan wants to merge 1 commit intogolang:masterfrom
kovan:fix-os-examples-77643
Open

os: update examples to use errors.Is instead of deprecated functions#77645
kovan wants to merge 1 commit intogolang:masterfrom
kovan:fix-os-examples-77643

Conversation

@kovan
Copy link
Contributor

@kovan kovan commented Feb 16, 2026

Summary

  • Updated ExampleMkdir to use errors.Is(err, fs.ErrExist) instead of os.IsExist(err)
  • Updated ExampleUserConfigDir to use errors.Is(err, fs.ErrNotExist) instead of os.IsNotExist(err)
  • Both os.IsExist and os.IsNotExist docs recommend using errors.Is for new code

Fixes #77643

🤖 Generated with Claude Code

The os.IsExist and os.IsNotExist functions predate errors.Is and their
documentation recommends using errors.Is(err, fs.ErrExist) and
errors.Is(err, fs.ErrNotExist) instead. Update ExampleMkdir and
ExampleUserConfigDir to follow this recommendation.

Fixes golang#77643

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: Id98cafa89b80004f119cb2daf799aaecee259cab
@google-cla
Copy link

google-cla bot commented Feb 16, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

os: some examples use functions obviated by errors.Is

1 participant