mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00: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:
@@ -7,7 +7,6 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -96,7 +95,7 @@ func (s *DockerSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
||||
RUN [ $(stat -c %U:%G "/bar") = 'root:root' ]
|
||||
RUN [ $(stat -c %U:%G "/bar/foo") = 'root:root' ]
|
||||
`
|
||||
tmpDir, err := ioutil.TempDir("", "fake-context")
|
||||
tmpDir, err := os.MkdirTemp("", "fake-context")
|
||||
assert.NilError(c, err)
|
||||
testFile, err := os.Create(filepath.Join(tmpDir, "foo"))
|
||||
if err != nil {
|
||||
@@ -109,7 +108,7 @@ func (s *DockerSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
||||
Dir: tmpDir,
|
||||
}).Assert(c, icmd.Success)
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(tmpDir, "Dockerfile"), []byte(dockerfile), 0644); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(tmpDir, "Dockerfile"), []byte(dockerfile), 0644); err != nil {
|
||||
c.Fatalf("failed to open destination dockerfile: %v", err)
|
||||
}
|
||||
return fakecontext.New(c, tmpDir)
|
||||
|
||||
Reference in New Issue
Block a user