1
0
mirror of https://github.com/moby/moby.git synced 2025-10-24 09:13:09 +03:00

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

@@ -7,7 +7,6 @@ import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
@@ -27,7 +26,7 @@ func (s *DockerSuite) TestEventsRedirectStdout(c *testing.T) {
since := daemonUnixTime(c)
dockerCmd(c, "run", "busybox", "true")
file, err := ioutil.TempFile("", "")
file, err := os.CreateTemp("", "")
assert.NilError(c, err, "could not create temp file")
defer os.Remove(file.Name())
@@ -395,14 +394,14 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
defer os.Remove(configFilePath)
daemonConfig := `{"labels":["foo=bar"]}`
err := ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644)
err := os.WriteFile(configFilePath, []byte(daemonConfig), 0644)
assert.NilError(c, err)
s.d.Start(c, "--config-file="+configFilePath)
info := s.d.Info(c)
daemonConfig = `{"max-concurrent-downloads":1,"labels":["bar=foo"], "shutdown-timeout": 10}`
err = ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644)
err = os.WriteFile(configFilePath, []byte(daemonConfig), 0644)
assert.NilError(c, err)
assert.NilError(c, s.d.Signal(unix.SIGHUP))
@@ -446,7 +445,7 @@ func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *testing.T) {
defer os.Remove(configFilePath)
daemonConfig := `{"labels":["foo=bar"]}`
err := ioutil.WriteFile(configFilePath, []byte(daemonConfig), 0644)
err := os.WriteFile(configFilePath, []byte(daemonConfig), 0644)
assert.NilError(c, err)
s.d.Start(c, "--config-file="+configFilePath)