cli/command/service: remove deprecated io/ioutil

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-02-25 14:30:56 +01:00
parent c558df7ced
commit d1f26de646
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 4 additions and 5 deletions

View File

@ -3,7 +3,6 @@ package service
import ( import (
"context" "context"
"io" "io"
"io/ioutil"
"github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/service/progress" "github.com/docker/cli/cli/command/service/progress"
@ -21,7 +20,7 @@ func waitOnService(ctx context.Context, dockerCli command.Cli, serviceID string,
}() }()
if quiet { if quiet {
go io.Copy(ioutil.Discard, pipeReader) go io.Copy(io.Discard, pipeReader)
return <-errChan return <-errChan
} }

View File

@ -3,7 +3,7 @@ package service
import ( import (
"context" "context"
"fmt" "fmt"
"io/ioutil" "io"
"strings" "strings"
"testing" "testing"
@ -49,7 +49,7 @@ func TestRollback(t *testing.T) {
cmd := newRollbackCommand(cli) cmd := newRollbackCommand(cli)
cmd.SetArgs(tc.args) cmd.SetArgs(tc.args)
cmd.Flags().Set("quiet", "true") cmd.Flags().Set("quiet", "true")
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.NilError(t, cmd.Execute()) assert.NilError(t, cmd.Execute())
assert.Check(t, is.Equal(strings.TrimSpace(cli.ErrBuffer().String()), tc.expectedDockerCliErr)) assert.Check(t, is.Equal(strings.TrimSpace(cli.ErrBuffer().String()), tc.expectedDockerCliErr))
} }
@ -98,7 +98,7 @@ func TestRollbackWithErrors(t *testing.T) {
})) }))
cmd.SetArgs(tc.args) cmd.SetArgs(tc.args)
cmd.Flags().Set("quiet", "true") cmd.Flags().Set("quiet", "true")
cmd.SetOut(ioutil.Discard) cmd.SetOut(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError) assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
} }
} }