Home > OS >  ioutil.ReadAll / ioutil.ReadFile / ioutil.ReadDir deprecated
ioutil.ReadAll / ioutil.ReadFile / ioutil.ReadDir deprecated

Time:01-24

Starting from Go 1.16, ioutil.ReadAll, ioutil.ReadFile and ioutil.ReadDir are deprecated, as the package io/ioutil is deprecated.

What other stdlib packages provide the same functionality?

CodePudding user response:

ioutil.ReadAll -> io.ReadAll
ioutil.ReadFile -> os.ReadFile
ioutil.ReadDir -> os.ReadDir
// others
ioutil.NopCloser -> io.NopCloser
ioutil.ReadDir -> os.ReadDir
ioutil.TempDir -> os.MkdirTemp
ioutil.TempFile -> os.CreateTemp
ioutil.WriteFile -> os.WriteFile
  •  Tags:  
  • go
  • Related