From 0c6a059f71e421738991fb2d74ad849272266eb5 Mon Sep 17 00:00:00 2001 From: Eric Briand Date: Mon, 15 Oct 2018 13:37:29 +0200 Subject: [PATCH] gcp: check if bucket exists after client creation Signed-off-by: Eric Briand --- src/cmd/linuxkit/push_gcp.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd/linuxkit/push_gcp.go b/src/cmd/linuxkit/push_gcp.go index 826c86da1..884e08c85 100644 --- a/src/cmd/linuxkit/push_gcp.go +++ b/src/cmd/linuxkit/push_gcp.go @@ -52,15 +52,15 @@ func pushGcp(args []string) { name = filepath.Base(name) } - if bucket == "" { - log.Fatalf("Please specify the bucket to use") - } - client, err := NewGCPClient(keys, project) if err != nil { log.Fatalf("Unable to connect to GCP: %v", err) } + if bucket == "" { + log.Fatalf("Please specify the bucket to use") + } + err = client.UploadFile(path, name+suffix, bucket, public) if err != nil { log.Fatalf("Error copying to Google Storage: %v", err)