diff --git a/cli/command/secret/create.go b/cli/command/secret/create.go index 79456fdf30..b6ae84b46f 100644 --- a/cli/command/secret/create.go +++ b/cli/command/secret/create.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" @@ -101,7 +100,7 @@ func readSecretData(in io.ReadCloser, file string) ([]byte, error) { } defer in.Close() } - data, err := ioutil.ReadAll(in) + data, err := io.ReadAll(in) if err != nil { return nil, err } diff --git a/cli/command/secret/create_test.go b/cli/command/secret/create_test.go index 5d12b84c71..5ca892877a 100644 --- a/cli/command/secret/create_test.go +++ b/cli/command/secret/create_test.go @@ -1,7 +1,8 @@ package secret import ( - "io/ioutil" + "io" + "os" "path/filepath" "reflect" "strings" @@ -44,14 +45,14 @@ func TestSecretCreateErrors(t *testing.T) { }), ) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } func TestSecretCreateWithName(t *testing.T) { name := "foo" - data, err := ioutil.ReadFile(filepath.Join("testdata", secretDataFile)) + data, err := os.ReadFile(filepath.Join("testdata", secretDataFile)) assert.NilError(t, err) expected := swarm.SecretSpec{ diff --git a/cli/command/secret/inspect_test.go b/cli/command/secret/inspect_test.go index d4eda421df..6919cb8943 100644 --- a/cli/command/secret/inspect_test.go +++ b/cli/command/secret/inspect_test.go @@ -2,7 +2,7 @@ package secret import ( "fmt" - "io/ioutil" + "io" "testing" "time" @@ -59,7 +59,7 @@ func TestSecretInspectErrors(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/secret/ls_test.go b/cli/command/secret/ls_test.go index bfc1f3c4ff..4c8b635fd1 100644 --- a/cli/command/secret/ls_test.go +++ b/cli/command/secret/ls_test.go @@ -1,7 +1,7 @@ package secret import ( - "io/ioutil" + "io" "testing" "time" @@ -40,7 +40,7 @@ func TestSecretListErrors(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/secret/remove_test.go b/cli/command/secret/remove_test.go index a52e5d1f74..c9f24dc22b 100644 --- a/cli/command/secret/remove_test.go +++ b/cli/command/secret/remove_test.go @@ -1,7 +1,7 @@ package secret import ( - "io/ioutil" + "io" "strings" "testing" @@ -36,7 +36,7 @@ func TestSecretRemoveErrors(t *testing.T) { }), ) cmd.SetArgs(tc.args) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) } } @@ -72,7 +72,7 @@ func TestSecretRemoveContinueAfterError(t *testing.T) { }) cmd := newSecretRemoveCommand(cli) - cmd.SetOut(ioutil.Discard) + cmd.SetOut(io.Discard) cmd.SetArgs(names) assert.Error(t, cmd.Execute(), "error removing secret: foo") assert.Check(t, is.DeepEqual(names, removedSecrets))