From 779012af69f8e3f46bb42877440149c4ddfe54af Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 1 May 2017 14:54:56 -0400 Subject: [PATCH] Refacator pkg/streamformatter StreamFormatter suffered was two distinct structs mixed into a single struct without any overlap. Signed-off-by: Daniel Nephin --- cli/command/image/build.go | 2 +- cli/command/image/build/context.go | 2 +- cli/command/service/progress/progress.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 5d4c2557c7..5ab3829bea 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -254,7 +254,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error { } // Setup an upload progress bar - progressOutput := streamformatter.NewStreamFormatter().NewProgressOutput(progBuff, true) + progressOutput := streamformatter.NewProgressOutput(progBuff) if !dockerCli.Out().IsTerminal() { progressOutput = &lastProgressOutput{output: progressOutput} } diff --git a/cli/command/image/build/context.go b/cli/command/image/build/context.go index da8cf11e9e..e6165aa975 100644 --- a/cli/command/image/build/context.go +++ b/cli/command/image/build/context.go @@ -165,7 +165,7 @@ func GetContextFromURL(out io.Writer, remoteURL, dockerfileName string) (io.Read if err != nil { return nil, "", errors.Errorf("unable to download remote context %s: %v", remoteURL, err) } - progressOutput := streamformatter.NewStreamFormatter().NewProgressOutput(out, true) + progressOutput := streamformatter.NewProgressOutput(out) // Pass the response body through a progress reader. progReader := progress.NewProgressReader(response.Body, progressOutput, response.ContentLength, "", fmt.Sprintf("Downloading build context from remote url: %s", remoteURL)) diff --git a/cli/command/service/progress/progress.go b/cli/command/service/progress/progress.go index 61c040df5e..266a949814 100644 --- a/cli/command/service/progress/progress.go +++ b/cli/command/service/progress/progress.go @@ -63,7 +63,7 @@ func stateToProgress(state swarm.TaskState, rollback bool) int64 { func ServiceProgress(ctx context.Context, client client.APIClient, serviceID string, progressWriter io.WriteCloser) error { defer progressWriter.Close() - progressOut := streamformatter.NewJSONStreamFormatter().NewProgressOutput(progressWriter, false) + progressOut := streamformatter.NewJSONProgressOutput(progressWriter, false) sigint := make(chan os.Signal, 1) signal.Notify(sigint, os.Interrupt)