Skip to content

Commit 34f5b30

Browse files
committed
driver/docker-container: remove uses of jsonmessage
This function was always using `io.Discard` for printing the progress, so we can use the `Wait()` method, which reads the stream, returning any error (similar to jsonmessage.DisplayJSONMessagesStream), and closes the stream either if the context is cancelled, or if the stream ends. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 182f1f4 commit 34f5b30

File tree

3 files changed

+1
-249
lines changed

3 files changed

+1
-249
lines changed

driver/docker-container/driver.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/moby/moby/api/types/container"
2828
"github.com/moby/moby/api/types/mount"
2929
dockerclient "github.com/moby/moby/client"
30-
"github.com/moby/moby/client/pkg/jsonmessage"
3130
"github.com/moby/moby/client/pkg/security"
3231
"github.com/pkg/errors"
3332
)
@@ -103,8 +102,7 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error {
103102
if err != nil {
104103
return err
105104
}
106-
defer resp.Close()
107-
return jsonmessage.DisplayJSONMessagesStream(resp, io.Discard, 0, false, nil)
105+
return resp.Wait(ctx)
108106
}); err != nil {
109107
// image pulling failed, check if it exists in local image store.
110108
// if not, return pulling error. otherwise log it.

vendor/github.com/moby/moby/client/pkg/jsonmessage/jsonmessage.go

Lines changed: 0 additions & 245 deletions
This file was deleted.

vendor/modules.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ github.com/moby/moby/api/types/volume
776776
github.com/moby/moby/client
777777
github.com/moby/moby/client/internal
778778
github.com/moby/moby/client/internal/timestamp
779-
github.com/moby/moby/client/pkg/jsonmessage
780779
github.com/moby/moby/client/pkg/security
781780
github.com/moby/moby/client/pkg/stringid
782781
github.com/moby/moby/client/pkg/versions

0 commit comments

Comments
 (0)