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

Stop using the methods from io/ioutil as they are deprecated since Go 1.16 #1220

Merged
merged 6 commits into from Nov 18, 2022
Merged

Stop using the methods from io/ioutil as they are deprecated since Go 1.16 #1220

merged 6 commits into from Nov 18, 2022

Conversation

stefafafan
Copy link
Contributor

The io/ioutil package is deprecated since Go 1.16. https://go.dev/doc/go1.16#ioutil

I see sqlboiler is using Go 1.16 (https://github.com/volatiletech/sqlboiler/blob/master/go.mod#L3), so I've went ahead and replaced the old methods exported by io/ioutil to the corresponding methods moved to io and os packages.

As in the documentation, below is the list of old to new names, so for each commit I replaced the functions. In my final commit I removed the io/ioutil import which ended up not being needed anymore.

Discard => io.Discard
NopCloser => io.NopCloser
ReadAll => io.ReadAll
ReadDir => os.ReadDir (note: returns a slice of os.DirEntry rather than a slice of fs.FileInfo)
ReadFile => os.ReadFile
TempDir => os.MkdirTemp
TempFile => os.CreateTemp
WriteFile => os.WriteFile

@stephenafamo
Copy link
Collaborator

Thanks for this.

@stephenafamo stephenafamo merged commit 22497a8 into volatiletech:master Nov 18, 2022
@stefafafan stefafafan deleted the fix-ioutil-deprecations branch November 18, 2022 07:44
@xrn
Copy link
Contributor

xrn commented Nov 20, 2022

@stephenafamo is there a chance that soon would be new release?

@stephenafamo
Copy link
Collaborator

I'll tag a new release in a couple weeks

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