summaryrefslogtreecommitdiff
path: root/libcontainerd
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2021-08-24 18:10:50 +0800
committerEng Zer Jun <engzerjun@gmail.com>2021-08-27 14:56:57 +0800
commitc55a4ac7795c7606b548b38e24673733481e2167 (patch)
tree8ea03bdc842959cd3d04a3e37a4ce2a71fa77dbb /libcontainerd
parent2b70006e3bfa492b8641ff443493983d832955f4 (diff)
downloaddocker-c55a4ac7795c7606b548b38e24673733481e2167.tar.gz
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>
Diffstat (limited to 'libcontainerd')
-rw-r--r--libcontainerd/local/local_windows.go6
-rw-r--r--libcontainerd/supervisor/remote_daemon.go3
2 files changed, 4 insertions, 5 deletions
diff --git a/libcontainerd/local/local_windows.go b/libcontainerd/local/local_windows.go
index 641e996e35..1cc35c0813 100644
--- a/libcontainerd/local/local_windows.go
+++ b/libcontainerd/local/local_windows.go
@@ -6,7 +6,7 @@ package local // import "github.com/docker/docker/libcontainerd/local"
import (
"context"
"fmt"
- "io/ioutil"
+ "io"
"os"
"path/filepath"
"regexp"
@@ -548,10 +548,10 @@ func newIOFromProcess(newProcess hcsshim.Process, terminal bool) (*cio.DirectIO,
// Convert io.ReadClosers to io.Readers
if stdout != nil {
- dio.Stdout = ioutil.NopCloser(&autoClosingReader{ReadCloser: stdout})
+ dio.Stdout = io.NopCloser(&autoClosingReader{ReadCloser: stdout})
}
if stderr != nil {
- dio.Stderr = ioutil.NopCloser(&autoClosingReader{ReadCloser: stderr})
+ dio.Stderr = io.NopCloser(&autoClosingReader{ReadCloser: stderr})
}
return dio, nil
}
diff --git a/libcontainerd/supervisor/remote_daemon.go b/libcontainerd/supervisor/remote_daemon.go
index 1a655839ee..2f38f1505c 100644
--- a/libcontainerd/supervisor/remote_daemon.go
+++ b/libcontainerd/supervisor/remote_daemon.go
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -211,7 +210,7 @@ func (r *remote) startContainerd() error {
r.daemonPid = cmd.Process.Pid
- err = ioutil.WriteFile(filepath.Join(r.stateDir, pidFile), []byte(fmt.Sprintf("%d", r.daemonPid)), 0660)
+ err = os.WriteFile(filepath.Join(r.stateDir, pidFile), []byte(fmt.Sprintf("%d", r.daemonPid)), 0660)
if err != nil {
system.KillProcess(r.daemonPid)
return errors.Wrap(err, "libcontainerd: failed to save daemon pid to disk")