From e6b6d107f7157bb515564f628e5b9b455e295db3 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
+ The 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
and
+ os
packages.
+
+ Here is a list of the new locations of the names exported
+ by io/ioutil
:
+
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
Discard
,
+ NopCloser
, and
+ ReadAll
,
+ to be used instead of the same names in the
+ io/ioutil
package.
+
@@ -896,6 +943,16 @@ func TestFoo(t *testing.T) {
instead of the unexported errFinished
when the process has
already finished.
+
+
+ The package now defines
+ CreateTemp
,
+ MkdirTemp
,
+ ReadFile
, and
+ WriteFile
,
+ to be used instead of functions defined in the
+ io/ioutil
package.
+