{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/comments/80029756","id":80029756,"diff_hunk":"@@ -0,0 +1,196 @@\n+// Copyright 2016 Google Inc. All rights reserved.\n+// Use of this source code is governed by the Apache 2.0\n+// license that can be found in the LICENSE file.\n+\n+// Sample objects creates, list, deletes objects and runs\n+// other similar operations on them by using the Google Storage API.\n+// More documentation is available at\n+// https://cloud.google.com/storage/docs/json_api/v1/.\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"log\"\n+\t\"os\"\n+\t\"time\"\n+\n+\t\"golang.org/x/net/context\"\n+\n+\t\"cloud.google.com/go/storage\"\n+)\n+\n+var objectName = fmt.Sprintf(\"golang-example-objects-%d\", time.Now().Unix())\n+\n+const (\n+\tbucketName    = \"golang-example-objects-bucket\"\n+\tdstBucketName = \"golang-example-objects-bucket-dst\"\n+)\n+\n+func main() {\n+\tprojectID := os.Getenv(\"GOOGLE_CLOUD_PROJECT\")\n+\tif projectID == \"\" {\n+\t\tfmt.Fprintf(os.Stderr, \"GOOGLE_CLOUD_PROJECT environment variable must be set.\\n\")\n+\t\tos.Exit(1)\n+\t}\n+\n+\tctx := context.Background()\n+\tclient, err := storage.NewClient(ctx)\n+\tif err != nil {\n+\t\tlog.Fatal(err)\n+\t}\n+\n+\tif err := createBucketIfNotexits(ctx, client, projectID, bucketName); err != nil {\n+\t\tlog.Fatal(err)\n+\t}\n+\t// create another bucket later to be used to copy objects from the prev one.\n+\tif err := createBucketIfNotexits(ctx, client, projectID, dstBucketName); err != nil {","path":"storage/objects/main.go","position":48,"original_position":48,"commit_id":"498bf42d14287c6c49ce80559c2f51f236514ac3","original_commit_id":"498bf42d14287c6c49ce80559c2f51f236514ac3","user":{"login":"jba","id":18483045,"avatar_url":"https://avatars.githubusercontent.com/u/18483045?v=3","gravatar_id":"","url":"https://api.github.com/users/jba","html_url":"https://github.com/jba","followers_url":"https://api.github.com/users/jba/followers","following_url":"https://api.github.com/users/jba/following{/other_user}","gists_url":"https://api.github.com/users/jba/gists{/gist_id}","starred_url":"https://api.github.com/users/jba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jba/subscriptions","organizations_url":"https://api.github.com/users/jba/orgs","repos_url":"https://api.github.com/users/jba/repos","events_url":"https://api.github.com/users/jba/events{/privacy}","received_events_url":"https://api.github.com/users/jba/received_events","type":"User","site_admin":false},"body":"s/exits/Exists/","created_at":"2016-09-22T12:33:26Z","updated_at":"2016-09-22T12:33:26Z","html_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/126#discussion_r80029756","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/comments/80029756"},"html":{"href":"https://github.com/GoogleCloudPlatform/golang-samples/pull/126#discussion_r80029756"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126","id":86265838,"html_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/126","diff_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/126.diff","patch_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/126.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/126","number":126,"state":"open","locked":false,"title":"storage: initial commit of the objects program","user":{"login":"rakyll","id":108380,"avatar_url":"https://avatars.githubusercontent.com/u/108380?v=3","gravatar_id":"","url":"https://api.github.com/users/rakyll","html_url":"https://github.com/rakyll","followers_url":"https://api.github.com/users/rakyll/followers","following_url":"https://api.github.com/users/rakyll/following{/other_user}","gists_url":"https://api.github.com/users/rakyll/gists{/gist_id}","starred_url":"https://api.github.com/users/rakyll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakyll/subscriptions","organizations_url":"https://api.github.com/users/rakyll/orgs","repos_url":"https://api.github.com/users/rakyll/repos","events_url":"https://api.github.com/users/rakyll/events{/privacy}","received_events_url":"https://api.github.com/users/rakyll/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-22T00:54:04Z","updated_at":"2016-09-22T12:43:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1c71080fec01150a78dedb8e183afefc0dcf887","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/126/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/statuses/498bf42d14287c6c49ce80559c2f51f236514ac3","head":{"label":"GoogleCloudPlatform:objects","ref":"objects","sha":"498bf42d14287c6c49ce80559c2f51f236514ac3","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":43332504,"name":"golang-samples","full_name":"GoogleCloudPlatform/golang-samples","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/golang-samples","description":"Sample apps and code written in the Go programming language.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/deployments","created_at":"2015-09-28T23:20:08Z","updated_at":"2016-09-19T16:14:05Z","pushed_at":"2016-09-22T00:54:04Z","git_url":"git://github.com/GoogleCloudPlatform/golang-samples.git","ssh_url":"git@github.com:GoogleCloudPlatform/golang-samples.git","clone_url":"https://github.com/GoogleCloudPlatform/golang-samples.git","svn_url":"https://github.com/GoogleCloudPlatform/golang-samples","homepage":null,"size":688,"stargazers_count":106,"watchers_count":106,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":19,"forks":36,"open_issues":19,"watchers":106,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"c1b6029fa631e35af74f3150eaf3bd9f86e1d91f","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":43332504,"name":"golang-samples","full_name":"GoogleCloudPlatform/golang-samples","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/golang-samples","description":"Sample apps and code written in the Go programming language.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/deployments","created_at":"2015-09-28T23:20:08Z","updated_at":"2016-09-19T16:14:05Z","pushed_at":"2016-09-22T00:54:04Z","git_url":"git://github.com/GoogleCloudPlatform/golang-samples.git","ssh_url":"git@github.com:GoogleCloudPlatform/golang-samples.git","clone_url":"https://github.com/GoogleCloudPlatform/golang-samples.git","svn_url":"https://github.com/GoogleCloudPlatform/golang-samples","homepage":null,"size":688,"stargazers_count":106,"watchers_count":106,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":19,"forks":36,"open_issues":19,"watchers":106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126"},"html":{"href":"https://github.com/GoogleCloudPlatform/golang-samples/pull/126"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/126"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/126/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/126/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/statuses/498bf42d14287c6c49ce80559c2f51f236514ac3"}}}}
{"actor":{"display_login":"jba"}}