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

The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2021-08-24 18:10:50 +08:00
parent 2b70006e3b
commit c55a4ac779
397 changed files with 1371 additions and 1606 deletions

View File

@@ -1,7 +1,6 @@
package daemon // import "github.com/docker/docker/daemon"
import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -147,7 +146,7 @@ func TestContainerInitDNS(t *testing.T) {
t.Skip("root required") // for chown
}
tmp, err := ioutil.TempDir("", "docker-container-test-")
tmp, err := os.MkdirTemp("", "docker-container-test-")
if err != nil {
t.Fatal(err)
}
@@ -181,7 +180,7 @@ func TestContainerInitDNS(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if err = ioutil.WriteFile(configPath, []byte(config), 0644); err != nil {
if err = os.WriteFile(configPath, []byte(config), 0644); err != nil {
t.Fatal(err)
}
@@ -194,7 +193,7 @@ func TestContainerInitDNS(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if err = ioutil.WriteFile(hostConfigPath, []byte(hostConfig), 0644); err != nil {
if err = os.WriteFile(hostConfigPath, []byte(hostConfig), 0644); err != nil {
t.Fatal(err)
}