cloudpods icon indicating copy to clipboard operation
cloudpods copied to clipboard

refactor: move from io/ioutil to io and os packages

Open Juneezee opened this issue 3 years ago • 0 comments

What this PR does / why we need it:

The io/ioutil package has been deprecated in Go 1.16 (See https://pkg.go.dev/io/ioutil). This PR replaces the existing io/ioutil functions with their new definitions in io and os packages.

  • ioutil.Discard => io.Discard
  • ioutil.NopCloser => io.NopCloser
  • ioutil.ReadAll => io.ReadAll
  • ioutil.ReadDir => os.ReadDir (returns a slice of os.DirEntry rather than a slice of fs.FileInfo, this may improve performance in some cases as os.ReadDir is more efficient [1])
  • ioutil.ReadFile => os.ReadFile
  • ioutil.TempDir => os.MkdirTemp
  • ioutil.TempFile => os.CreateTemp
  • ioutil.WriteFile => os.WriteFile

Does this PR need to be backport to the previous release branch?:

NONE

Juneezee avatar Sep 16 '22 16:09 Juneezee