From 783b4e914a966d17d01b54c87534a2e43ef4bc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Tigerstr=C3=B6m?= Date: Tue, 11 Oct 2022 22:59:39 +0200 Subject: [PATCH] Change to correct break statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakob Tigerström --- pkg/bindings/images/pull.go | 3 ++- pkg/bindings/images/push.go | 3 ++- pkg/bindings/manifests/manifests.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/bindings/images/pull.go b/pkg/bindings/images/pull.go index 8caf45c0e1..43592f6e21 100644 --- a/pkg/bindings/images/pull.go +++ b/pkg/bindings/images/pull.go @@ -69,6 +69,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string, dec := json.NewDecoder(response.Body) var images []string var pullErrors []error +LOOP: for { var report entities.ImagePullReport if err := dec.Decode(&report); err != nil { @@ -80,7 +81,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string, select { case <-response.Request.Context().Done(): - break + break LOOP default: // non-blocking select } diff --git a/pkg/bindings/images/push.go b/pkg/bindings/images/push.go index 0e1309e919..c04ffbf904 100644 --- a/pkg/bindings/images/push.go +++ b/pkg/bindings/images/push.go @@ -67,6 +67,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO } dec := json.NewDecoder(response.Body) +LOOP: for { var report entities.ImagePushReport if err := dec.Decode(&report); err != nil { @@ -78,7 +79,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO select { case <-response.Request.Context().Done(): - break + break LOOP default: // non-blocking select } diff --git a/pkg/bindings/manifests/manifests.go b/pkg/bindings/manifests/manifests.go index d987e51d80..ed605bd7b2 100644 --- a/pkg/bindings/manifests/manifests.go +++ b/pkg/bindings/manifests/manifests.go @@ -199,7 +199,7 @@ func Push(ctx context.Context, name, destination string, options *images.PushOpt select { case <-response.Request.Context().Done(): - break + return "", context.Canceled default: // non-blocking select }