From 03d93a93c3e8c44c08894d8e27cab9f335b25f2c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 25 Feb 2022 14:34:38 +0100 Subject: [PATCH] cli/command/volume: remove deprecated io/ioutil Signed-off-by: Sebastiaan van Stijn (cherry picked from commit cca73bff41382c25bcf5d695120a520ce72f23c1) Signed-off-by: Cory Snider --- cli/command/volume/create_test.go | 4 ++-- cli/command/volume/inspect_test.go | 4 ++-- cli/command/volume/list_test.go | 4 ++-- cli/command/volume/prune_test.go | 8 ++++---- cli/command/volume/remove_test.go | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index e9eaa58179..875253b5c8 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -1,7 +1,7 @@ package volume import ( - "io/ioutil" + "io" "reflect" "strings" "testing" @@ -49,7 +49,7 @@ func TestVolumeCreateErrors(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/inspect_test.go b/cli/command/volume/inspect_test.go index 49907202bc..40ab82c50b 100644 --- a/cli/command/volume/inspect_test.go +++ b/cli/command/volume/inspect_test.go @@ -2,7 +2,7 @@ package volume import ( "fmt" - "io/ioutil" + "io" "testing" "github.com/docker/cli/internal/test" @@ -60,7 +60,7 @@ func TestVolumeInspectErrors(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/list_test.go b/cli/command/volume/list_test.go index 2c1501e5c7..77f63d5219 100644 --- a/cli/command/volume/list_test.go +++ b/cli/command/volume/list_test.go @@ -1,7 +1,7 @@ package volume import ( - "io/ioutil" + "io" "testing" "github.com/docker/cli/cli/config/configfile" @@ -43,7 +43,7 @@ func TestVolumeListErrors(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/volume/prune_test.go b/cli/command/volume/prune_test.go index 8e668c57f6..7cfbad66b3 100644 --- a/cli/command/volume/prune_test.go +++ b/cli/command/volume/prune_test.go @@ -2,7 +2,7 @@ package volume import ( "fmt" - "io/ioutil" + "io" "runtime" "strings" "testing" @@ -48,7 +48,7 @@ func TestVolumePruneErrors(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -86,7 +86,7 @@ func TestVolumePrunePromptYes(t *testing.T) { volumePruneFunc: simplePruneFunc, }) - cli.SetIn(streams.NewIn(ioutil.NopCloser(strings.NewReader(input)))) + cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input)))) cmd := NewPruneCommand(cli) assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-prune-yes.golden") @@ -102,7 +102,7 @@ func TestVolumePrunePromptNo(t *testing.T) { volumePruneFunc: simplePruneFunc, }) - cli.SetIn(streams.NewIn(ioutil.NopCloser(strings.NewReader(input)))) + cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input)))) cmd := NewPruneCommand(cli) assert.NilError(t, cmd.Execute()) golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden") diff --git a/cli/command/volume/remove_test.go b/cli/command/volume/remove_test.go index 19bc467d70..6f617f9ce0 100644 --- a/cli/command/volume/remove_test.go +++ b/cli/command/volume/remove_test.go @@ -1,7 +1,7 @@ package volume import ( - "io/ioutil" + "io" "testing" "github.com/docker/cli/internal/test" @@ -32,7 +32,7 @@ func TestVolumeRemoveErrors(t *testing.T) { volumeRemoveFunc: tc.volumeRemoveFunc, })) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } }