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

Replace deprecated io/ioutil from golang #1505

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

seokho-son
Copy link
Member

Replace deprecated functions. (Deprecation of io/ioutil as of Go 1.16)

https://go.dev/doc/go1.16#ioutil

Deprecation of io/ioutil
The [io/ioutil](https://go.dev/pkg/io/ioutil/) package has turned out to be a poorly defined and hard to understand collection of things. All functionality provided by the package has been moved to other packages. The io/ioutil package remains and will continue to work as before, but we encourage new code to use the new definitions in the [io](https://go.dev/pkg/io/) and [os](https://go.dev/pkg/os/) packages. Here is a list of the new locations of the names exported by io/ioutil:

[Discard](https://go.dev/pkg/io/ioutil/#Discard) => [io.Discard](https://go.dev/pkg/io/#Discard)
[NopCloser](https://go.dev/pkg/io/ioutil/#NopCloser) => [io.NopCloser](https://go.dev/pkg/io/#NopCloser)
[ReadAll](https://go.dev/pkg/io/ioutil/#ReadAll) => [io.ReadAll](https://go.dev/pkg/io/#ReadAll)
[ReadDir](https://go.dev/pkg/io/ioutil/#ReadDir) => [os.ReadDir](https://go.dev/pkg/os/#ReadDir) (note: returns a slice of [os.DirEntry](https://go.dev/pkg/os/#DirEntry) rather than a slice of [fs.FileInfo](https://go.dev/pkg/io/fs/#FileInfo))
[ReadFile](https://go.dev/pkg/io/ioutil/#ReadFile) => [os.ReadFile](https://go.dev/pkg/os/#ReadFile)
[TempDir](https://go.dev/pkg/io/ioutil/#TempDir) => [os.MkdirTemp](https://go.dev/pkg/os/#MkdirTemp)
[TempFile](https://go.dev/pkg/io/ioutil/#TempFile) => [os.CreateTemp](https://go.dev/pkg/os/#CreateTemp)
[WriteFile](https://go.dev/pkg/io/ioutil/#WriteFile) => [os.WriteFile](https://go.dev/pkg/os/#WriteFile)

Signed-off-by: Seokho Son <shsongist@gmail.com>
@seokho-son
Copy link
Member Author

/approve

@github-actions github-actions bot added the approved This PR is approved and will be merged soon. label Apr 17, 2024
@cb-github-robot cb-github-robot merged commit 1fba5f3 into cloud-barista:main Apr 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved and will be merged soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants