gcp: check if bucket exists after client creation

Signed-off-by: Eric Briand <eric.briand@gmail.com>
This commit is contained in:
Eric Briand 2018-10-15 13:37:29 +02:00
parent b15d0963f4
commit 0c6a059f71

View File

@ -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)