diff --git a/cli/command/stack/deploy_test.go b/cli/command/stack/deploy_test.go index 0bffba383a..86215bdc32 100644 --- a/cli/command/stack/deploy_test.go +++ b/cli/command/stack/deploy_test.go @@ -1,7 +1,7 @@ package stack import ( - "io/ioutil" + "io" "testing" "github.com/docker/cli/internal/test" @@ -11,7 +11,7 @@ import ( func TestDeployWithEmptyName(t *testing.T) { cmd := newDeployCommand(test.NewFakeCli(&fakeClient{})) cmd.SetArgs([]string{"' '"}) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`) } diff --git a/cli/command/stack/list_test.go b/cli/command/stack/list_test.go index 371d1e6255..a78558d811 100644 --- a/cli/command/stack/list_test.go +++ b/cli/command/stack/list_test.go @@ -1,7 +1,7 @@ package stack import ( - "io/ioutil" + "io" "testing" "github.com/docker/cli/internal/test" @@ -49,7 +49,7 @@ func TestListErrors(t *testing.T) { serviceListFunc: tc.serviceListFunc, })) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) for key, value := range tc.flags { cmd.Flags().Set(key, value) } diff --git a/cli/command/stack/loader/loader.go b/cli/command/stack/loader/loader.go index c4333965fa..210803ceec 100644 --- a/cli/command/stack/loader/loader.go +++ b/cli/command/stack/loader/loader.go @@ -3,7 +3,6 @@ package loader import ( "fmt" "io" - "io/ioutil" "os" "path/filepath" "sort" @@ -132,9 +131,9 @@ func loadConfigFile(filename string, stdin io.Reader) (*composetypes.ConfigFile, var err error if filename == "-" { - bytes, err = ioutil.ReadAll(stdin) + bytes, err = io.ReadAll(stdin) } else { - bytes, err = ioutil.ReadFile(filename) + bytes, err = os.ReadFile(filename) } if err != nil { return nil, err diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index 9e62dcc5e5..8d44dbdb00 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -1,7 +1,7 @@ package stack import ( - "io/ioutil" + "io" "testing" "time" @@ -45,7 +45,7 @@ func TestStackPsErrors(t *testing.T) { taskListFunc: tc.taskListFunc, })) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -169,7 +169,7 @@ func TestStackPs(t *testing.T) { for key, value := range tc.flags { cmd.Flags().Set(key, value) } - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) if tc.expectedErr != "" { assert.Error(t, cmd.Execute(), tc.expectedErr) diff --git a/cli/command/stack/remove_test.go b/cli/command/stack/remove_test.go index 96bf38530f..7b56ccc6b3 100644 --- a/cli/command/stack/remove_test.go +++ b/cli/command/stack/remove_test.go @@ -2,7 +2,7 @@ package stack import ( "errors" - "io/ioutil" + "io" "strings" "testing" @@ -44,7 +44,7 @@ func fakeClientForRemoveStackTest(version string) *fakeClient { func TestRemoveWithEmptyName(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{})) cmd.SetArgs([]string{"good", "' '", "alsogood"}) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`) } @@ -155,7 +155,7 @@ func TestRemoveContinueAfterError(t *testing.T) { }, } cmd := newRemoveCommand(test.NewFakeCli(cli)) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) cmd.SetArgs([]string{"foo", "bar"}) assert.Error(t, cmd.Execute(), "Failed to remove some resources from stack: foo") diff --git a/cli/command/stack/services_test.go b/cli/command/stack/services_test.go index e5467591e7..e38c1b9534 100644 --- a/cli/command/stack/services_test.go +++ b/cli/command/stack/services_test.go @@ -1,7 +1,7 @@ package stack import ( - "io/ioutil" + "io" "testing" "github.com/docker/cli/cli/config/configfile" @@ -79,7 +79,7 @@ func TestStackServicesErrors(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) }) } @@ -88,7 +88,7 @@ func TestStackServicesErrors(t *testing.T) { func TestRunServicesWithEmptyName(t *testing.T) { cmd := newServicesCommand(test.NewFakeCli(&fakeClient{})) cmd.SetArgs([]string{"' '"}) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), `invalid stack name: "' '"`) }