-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Replace deprecated ioutil with io and os #10732
Conversation
Thanks for this. This needs to wait before I can merge; I have some bigger change sets in the merge pipeline in the near future, and I fear that these changes may create lots of potential merge conflicts. |
https://pkg.go.dev/io/ioutil is deprecated since Go 1.16.
To make the tests pass. * Replace io => os.ReadFile in magefile.go * Adjust failing image test vs fs.DirEntry * Adjust poller test See #10732
Created #10768 about data race in tests. |
@alexandear I'm going to merge this once the tests go green, but a general remark for the future: If you have a PR that states that it does one isolated thing (ioutil => os) it would be good if it also doesn't do some refactoring of something totally unrelated. I know it's tempting and I'm certainly throwing stones in a glass house here, but it makes PRs like these much harder to reason about than they should. |
To make the tests pass. * Replace io => os.ReadFile in magefile.go * Adjust failing image test vs fs.DirEntry * Adjust poller test See #10732
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR removes usages of
io/ioutil
.The package io/ioutil is deprecated since Go 1.16:
Changes
ioutil.ReadAll, ioutil.Discard, ioutil.NopCloser
withio.ReadAll, io.Discard, io.NopCloser
.ioutil.ReadFile, ioutil.WriteFile, ioutil.ReadDir
withos.ReadFile, os.WriteFile, os.ReadDir
.ioutil.TempFile
withos.CreateTemp
.ioutil.TempDir
withos.MkdirTemp
.Tests only
ioutil.TempDir
witht.TempDir()
.T.TempDir
automatically clears directory.initFsTests
by replacingioutil.TempDir
witht.TempDir
and usingt.Cleanup
instead of manualcleanup
.createEmptyTempDir
anddeleteTempDir
after refactoring tot.TempDir
.