{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/comments/85846882","pull_request_review_id":6538145,"id":85846882,"diff_hunk":"@@ -0,0 +1,91 @@\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+// Command simpleapp queries the Shakespeare sample dataset in Google BigQuery.\n+// [START bigquery_simple_app_all]\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"log\"\n+\t\"os\"\n+\n+\t\"cloud.google.com/go/bigquery\"\n+\t\"google.golang.org/api/iterator\"\n+\n+\t\"golang.org/x/net/context\"\n+)\n+\n+func main() {\n+\tproj := os.Getenv(\"GCLOUD_PROJECT\")\n+\tif proj == \"\" {\n+\t\tfmt.Println(\"GCLOUD_PROJECT environment variable must be set.\")\n+\t\tos.Exit(1)\n+\t}\n+\n+\trows, err := Query(proj)\n+\tif err != nil {\n+\t\tlog.Fatalln(err)\n+\t}\n+\terr = PrintResults(os.Stdout, rows)\n+\tif err != nil {\n+\t\tlog.Fatalln(err)\n+\t}\n+}\n+\n+// Query returns a slice of the results of a query.\n+// [START bigquery_simple_app_query]\n+func Query(proj string) (*bigquery.RowIterator, error) {\n+\tctx := context.Background()\n+\n+\tclient, err := bigquery.NewClient(ctx, proj)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tquery := client.Query(\n+\t\t\"SELECT \" +\n+\t\t\t\"APPROX_TOP_COUNT(corpus, 10) as title, \" +\n+\t\t\t\"COUNT(*) as unique_words \" +\n+\t\t\t\"FROM `publicdata.samples.shakespeare`;\")","path":"bigquery/simpleapp/simpleapp.go","position":52,"original_position":52,"commit_id":"48de618145c0bf9193a3c89d184c0b6a6d22f572","original_commit_id":"48de618145c0bf9193a3c89d184c0b6a6d22f572","user":{"login":"broady","id":24982,"avatar_url":"https://avatars.githubusercontent.com/u/24982?v=3","gravatar_id":"","url":"https://api.github.com/users/broady","html_url":"https://github.com/broady","followers_url":"https://api.github.com/users/broady/followers","following_url":"https://api.github.com/users/broady/following{/other_user}","gists_url":"https://api.github.com/users/broady/gists{/gist_id}","starred_url":"https://api.github.com/users/broady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broady/subscriptions","organizations_url":"https://api.github.com/users/broady/orgs","repos_url":"https://api.github.com/users/broady/repos","events_url":"https://api.github.com/users/broady/events{/privacy}","received_events_url":"https://api.github.com/users/broady/received_events","type":"User","site_admin":false},"body":"You might want to use Go's literal strings here?\r\n\r\nA bit awkward with the backticks in the dataset name, though :(","created_at":"2016-10-31T22:31:32Z","updated_at":"2016-10-31T22:31:32Z","html_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/148#discussion_r85846882","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/comments/85846882"},"html":{"href":"https://github.com/GoogleCloudPlatform/golang-samples/pull/148#discussion_r85846882"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148","id":91688832,"html_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/148","diff_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/148.diff","patch_url":"https://github.com/GoogleCloudPlatform/golang-samples/pull/148.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/148","number":148,"state":"open","locked":false,"title":"Add BigQuery simpleapp sample.","user":{"login":"tswast","id":247555,"avatar_url":"https://avatars.githubusercontent.com/u/247555?v=3","gravatar_id":"","url":"https://api.github.com/users/tswast","html_url":"https://github.com/tswast","followers_url":"https://api.github.com/users/tswast/followers","following_url":"https://api.github.com/users/tswast/following{/other_user}","gists_url":"https://api.github.com/users/tswast/gists{/gist_id}","starred_url":"https://api.github.com/users/tswast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tswast/subscriptions","organizations_url":"https://api.github.com/users/tswast/orgs","repos_url":"https://api.github.com/users/tswast/repos","events_url":"https://api.github.com/users/tswast/events{/privacy}","received_events_url":"https://api.github.com/users/tswast/received_events","type":"User","site_admin":false},"body":"This is to get included in the docs here: https://cloud.google.com/bigquery/create-simple-app-api","created_at":"2016-10-31T20:55:18Z","updated_at":"2016-10-31T22:35:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07277c659ffeb43c5097442711ebc17a73d841b5","assignee":{"login":"broady","id":24982,"avatar_url":"https://avatars.githubusercontent.com/u/24982?v=3","gravatar_id":"","url":"https://api.github.com/users/broady","html_url":"https://github.com/broady","followers_url":"https://api.github.com/users/broady/followers","following_url":"https://api.github.com/users/broady/following{/other_user}","gists_url":"https://api.github.com/users/broady/gists{/gist_id}","starred_url":"https://api.github.com/users/broady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broady/subscriptions","organizations_url":"https://api.github.com/users/broady/orgs","repos_url":"https://api.github.com/users/broady/repos","events_url":"https://api.github.com/users/broady/events{/privacy}","received_events_url":"https://api.github.com/users/broady/received_events","type":"User","site_admin":false},"assignees":[{"login":"broady","id":24982,"avatar_url":"https://avatars.githubusercontent.com/u/24982?v=3","gravatar_id":"","url":"https://api.github.com/users/broady","html_url":"https://github.com/broady","followers_url":"https://api.github.com/users/broady/followers","following_url":"https://api.github.com/users/broady/following{/other_user}","gists_url":"https://api.github.com/users/broady/gists{/gist_id}","starred_url":"https://api.github.com/users/broady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broady/subscriptions","organizations_url":"https://api.github.com/users/broady/orgs","repos_url":"https://api.github.com/users/broady/repos","events_url":"https://api.github.com/users/broady/events{/privacy}","received_events_url":"https://api.github.com/users/broady/received_events","type":"User","site_admin":false},{"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}],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148/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/148/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/statuses/48de618145c0bf9193a3c89d184c0b6a6d22f572","head":{"label":"GoogleCloudPlatform:tswast-bq","ref":"tswast-bq","sha":"48de618145c0bf9193a3c89d184c0b6a6d22f572","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-10-28T14:56:50Z","pushed_at":"2016-10-31T20:56:07Z","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":751,"stargazers_count":131,"watchers_count":131,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":24,"forks":45,"open_issues":24,"watchers":131,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"2127f4cc97e03f5f4b82a82f9f0a0a702b86b1dd","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-10-28T14:56:50Z","pushed_at":"2016-10-31T20:56:07Z","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":751,"stargazers_count":131,"watchers_count":131,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":24,"forks":45,"open_issues":24,"watchers":131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148"},"html":{"href":"https://github.com/GoogleCloudPlatform/golang-samples/pull/148"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/148"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/pulls/148/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/148/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/golang-samples/statuses/48de618145c0bf9193a3c89d184c0b6a6d22f572"}}}}
{"actor":{"display_login":"broady"}}