Home > Software engineering >  golang ioutil.ReadAll / ioutil.ReadFile / ioutil.ReadDir deprecated
golang ioutil.ReadAll / ioutil.ReadFile / ioutil.ReadDir deprecated

Time:01-23

For Go 1.16, ioutil.ReadAll / ioutil.ReadFile / ioutil.ReadDir are deprecated.

any new pakcages to use ?

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