diff --git a/cli/command/config/create.go b/cli/command/config/create.go index 863c41c1b7..04df13e2f6 100644 --- a/cli/command/config/create.go +++ b/cli/command/config/create.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" @@ -61,7 +60,7 @@ func RunConfigCreate(dockerCli command.Cli, options CreateOptions) error { defer file.Close() } - configData, err := ioutil.ReadAll(in) + configData, err := io.ReadAll(in) if err != nil { return errors.Errorf("Error reading content from %q: %v", options.File, err) } diff --git a/cli/command/config/create_test.go b/cli/command/config/create_test.go index e132651bb8..e65d488ce6 100644 --- a/cli/command/config/create_test.go +++ b/cli/command/config/create_test.go @@ -1,7 +1,8 @@ package config import ( - "io/ioutil" + "io" + "os" "path/filepath" "reflect" "strings" @@ -46,7 +47,7 @@ func TestConfigCreateErrors(t *testing.T) { }), ) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -82,7 +83,7 @@ func TestConfigCreateWithLabels(t *testing.T) { } name := "foo" - data, err := ioutil.ReadFile(filepath.Join("testdata", configDataFile)) + data, err := os.ReadFile(filepath.Join("testdata", configDataFile)) assert.NilError(t, err) expected := swarm.ConfigSpec{ diff --git a/cli/command/config/inspect_test.go b/cli/command/config/inspect_test.go index 6ac3a442ec..d30c891a98 100644 --- a/cli/command/config/inspect_test.go +++ b/cli/command/config/inspect_test.go @@ -2,7 +2,7 @@ package config import ( "fmt" - "io/ioutil" + "io" "testing" "time" @@ -59,7 +59,7 @@ func TestConfigInspectErrors(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/config/ls_test.go b/cli/command/config/ls_test.go index fcc5a62851..116c41bf5c 100644 --- a/cli/command/config/ls_test.go +++ b/cli/command/config/ls_test.go @@ -1,7 +1,7 @@ package config import ( - "io/ioutil" + "io" "testing" "time" @@ -40,7 +40,7 @@ func TestConfigListErrors(t *testing.T) { }), ) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } diff --git a/cli/command/config/remove_test.go b/cli/command/config/remove_test.go index 19a92dc407..bbdd0c4317 100644 --- a/cli/command/config/remove_test.go +++ b/cli/command/config/remove_test.go @@ -1,7 +1,7 @@ package config import ( - "io/ioutil" + "io" "strings" "testing" @@ -36,7 +36,7 @@ func TestConfigRemoveErrors(t *testing.T) { }), ) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -73,7 +73,7 @@ func TestConfigRemoveContinueAfterError(t *testing.T) { cmd := newConfigRemoveCommand(cli) cmd.SetArgs(names) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.Error(t, cmd.Execute(), "error removing config: foo") assert.Check(t, is.DeepEqual(names, removedConfigs)) }