{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments/89849577","pull_request_review_id":10381617,"id":89849577,"diff_hunk":"@@ -214,11 +251,72 @@ func TestGenerator(t *testing.T) {\n \t\t\t},\n \t\t},\n \t}\n+\n \tsort.Sort(fileSlice(want))\n \n \tif !reflect.DeepEqual(got, want) {\n \t\tt.Errorf(\"g.Generate(%q) = %s; want: %s\", repo, prettyFiles(got), prettyFiles(want))\n \t}\n+\n+\t// Tests for build tag filtering.\n+\n+\t// Counter for total files.\n+\tvar otherfiles, linuxfiles int\n+\n+\t// Ensure files were found for each type, as build tags are supported in C and assembly sources.\n+\tif _, ok := stub.goFiles[buildTagRepoPath]; !ok {\n+\t\tt.Fatalf(\"got no Go source files for %q; want more than zero\", buildTagRepoPath)\n+\t}\n+\tif _, ok := stub.sFiles[buildTagRepoPath]; !ok {\n+\t\tt.Fatalf(\"got no assembly source files for %q; want more than zero\", buildTagRepoPath)\n+\t}\n+\tif _, ok := stub.cFiles[buildTagRepoPath]; !ok {\n+\t\tt.Fatalf(\"got no assembly source files for %q; want more than zero\", buildTagRepoPath)\n+\t}\n+\n+\t// Count the Go files in the package.\n+\tfor _, file := range stub.goFiles[buildTagRepoPath] {\n+\t\tswitch {\n+\t\tcase strings.HasSuffix(file, \"_linux.go\"):\n+\t\t\tlinuxfiles++\n+\t\tcase strings.HasSuffix(file, \"_other.go\"):\n+\t\t\totherfiles++\n+\t\t}\n+\t}\n+\n+\t// We should have all otherfiles or all linux files depending on GOOS.\n+\tif otherfiles != 0 && linuxfiles != 0 {\n+\t\tt.Fatalf(\"got %d Go source files for \\\"linux\\\" and %d for \\\"!linux\\\" tag; want one or the other\", linuxfiles, otherfiles)\n+\t}\n+\n+\t// Count the assembly files in the package.\n+\tfor _, file := range stub.sFiles[buildTagRepoPath] {\n+\t\tswitch {\n+\t\tcase strings.HasSuffix(file, \"_linux.S\"):\n+\t\t\tlinuxfiles++\n+\t\tcase strings.HasSuffix(file, \"_other.S\"):\n+\t\t\totherfiles++\n+\t\t}\n+\t}\n+\t// If we fail here, tags worked for Go files but not assembly.\n+\tif otherfiles != 0 && linuxfiles != 0 {\n+\t\tt.Fatalf(\"got %d assembly files for \\\"linux\\\" and %d for \\\"!linux\\\" tag; want one or the other\", linuxfiles, otherfiles)\n+\t}\n+\n+\t// Count C files.\n+\tfor _, file := range stub.cFiles[buildTagRepoPath] {\n+\t\tswitch {\n+\t\tcase strings.HasSuffix(file, \"_linux.c\"):\n+\t\t\tlinuxfiles++\n+\t\tcase strings.HasSuffix(file, \"_other.c\"):\n+\t\t\totherfiles++\n+\t\t}\n+\t}\n+\n+\t// If we fail here, tags worked for assembly and Go files, but not C.\n+\tif otherfiles != 0 && linuxfiles != 0 {\n+\t\tt.Fatalf(\"got %d C files for \\\"linux\\\" and %d for \\\"!linux\\\" tag; want one or the other\", linuxfiles, otherfiles)","path":"go/tools/gazelle/generator/generator_test.go","position":null,"original_position":135,"commit_id":"622d080939d42832dbcf30b7dcc4fec539120c0a","original_commit_id":"dba038441983f5aa5f1631a35636b05b76adc401","user":{"login":"1-z","id":23519855,"avatar_url":"https://avatars.githubusercontent.com/u/23519855?v=3","gravatar_id":"","url":"https://api.github.com/users/1-z","html_url":"https://github.com/1-z","followers_url":"https://api.github.com/users/1-z/followers","following_url":"https://api.github.com/users/1-z/following{/other_user}","gists_url":"https://api.github.com/users/1-z/gists{/gist_id}","starred_url":"https://api.github.com/users/1-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1-z/subscriptions","organizations_url":"https://api.github.com/users/1-z/orgs","repos_url":"https://api.github.com/users/1-z/repos","events_url":"https://api.github.com/users/1-z/events{/privacy}","received_events_url":"https://api.github.com/users/1-z/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-11-28T18:41:32Z","updated_at":"2016-11-28T18:41:32Z","html_url":"https://github.com/bazelbuild/rules_go/pull/200#discussion_r89849577","pull_request_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments/89849577"},"html":{"href":"https://github.com/bazelbuild/rules_go/pull/200#discussion_r89849577"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200"}}},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200","id":94672808,"html_url":"https://github.com/bazelbuild/rules_go/pull/200","diff_url":"https://github.com/bazelbuild/rules_go/pull/200.diff","patch_url":"https://github.com/bazelbuild/rules_go/pull/200.patch","issue_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/200","number":200,"state":"open","locked":false,"title":"Set GOOS and GOARCH as BuildTags in Gazelle's generator","user":{"login":"1-z","id":23519855,"avatar_url":"https://avatars.githubusercontent.com/u/23519855?v=3","gravatar_id":"","url":"https://api.github.com/users/1-z","html_url":"https://github.com/1-z","followers_url":"https://api.github.com/users/1-z/followers","following_url":"https://api.github.com/users/1-z/following{/other_user}","gists_url":"https://api.github.com/users/1-z/gists{/gist_id}","starred_url":"https://api.github.com/users/1-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1-z/subscriptions","organizations_url":"https://api.github.com/users/1-z/orgs","repos_url":"https://api.github.com/users/1-z/repos","events_url":"https://api.github.com/users/1-z/events{/privacy}","received_events_url":"https://api.github.com/users/1-z/received_events","type":"User","site_admin":false},"body":"This solves issues where new_go_repository() fails for some open-source go repositories. After setting these, new_go_repository() appropriately filters source files by OS and architecture.","created_at":"2016-11-21T18:44:39Z","updated_at":"2016-11-28T18:41:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34b95720936db1205d19e9638f49a1211ce6be97","assignee":{"login":"pmbethe09","id":11632338,"avatar_url":"https://avatars.githubusercontent.com/u/11632338?v=3","gravatar_id":"","url":"https://api.github.com/users/pmbethe09","html_url":"https://github.com/pmbethe09","followers_url":"https://api.github.com/users/pmbethe09/followers","following_url":"https://api.github.com/users/pmbethe09/following{/other_user}","gists_url":"https://api.github.com/users/pmbethe09/gists{/gist_id}","starred_url":"https://api.github.com/users/pmbethe09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmbethe09/subscriptions","organizations_url":"https://api.github.com/users/pmbethe09/orgs","repos_url":"https://api.github.com/users/pmbethe09/repos","events_url":"https://api.github.com/users/pmbethe09/events{/privacy}","received_events_url":"https://api.github.com/users/pmbethe09/received_events","type":"User","site_admin":false},"assignees":[{"login":"pmbethe09","id":11632338,"avatar_url":"https://avatars.githubusercontent.com/u/11632338?v=3","gravatar_id":"","url":"https://api.github.com/users/pmbethe09","html_url":"https://github.com/pmbethe09","followers_url":"https://api.github.com/users/pmbethe09/followers","following_url":"https://api.github.com/users/pmbethe09/following{/other_user}","gists_url":"https://api.github.com/users/pmbethe09/gists{/gist_id}","starred_url":"https://api.github.com/users/pmbethe09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmbethe09/subscriptions","organizations_url":"https://api.github.com/users/pmbethe09/orgs","repos_url":"https://api.github.com/users/pmbethe09/repos","events_url":"https://api.github.com/users/pmbethe09/events{/privacy}","received_events_url":"https://api.github.com/users/pmbethe09/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200/comments","review_comment_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/200/comments","statuses_url":"https://api.github.com/repos/bazelbuild/rules_go/statuses/622d080939d42832dbcf30b7dcc4fec539120c0a","head":{"label":"1-z:master","ref":"master","sha":"622d080939d42832dbcf30b7dcc4fec539120c0a","user":{"login":"1-z","id":23519855,"avatar_url":"https://avatars.githubusercontent.com/u/23519855?v=3","gravatar_id":"","url":"https://api.github.com/users/1-z","html_url":"https://github.com/1-z","followers_url":"https://api.github.com/users/1-z/followers","following_url":"https://api.github.com/users/1-z/following{/other_user}","gists_url":"https://api.github.com/users/1-z/gists{/gist_id}","starred_url":"https://api.github.com/users/1-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1-z/subscriptions","organizations_url":"https://api.github.com/users/1-z/orgs","repos_url":"https://api.github.com/users/1-z/repos","events_url":"https://api.github.com/users/1-z/events{/privacy}","received_events_url":"https://api.github.com/users/1-z/received_events","type":"User","site_admin":false},"repo":{"id":74173515,"name":"rules_go","full_name":"1-z/rules_go","owner":{"login":"1-z","id":23519855,"avatar_url":"https://avatars.githubusercontent.com/u/23519855?v=3","gravatar_id":"","url":"https://api.github.com/users/1-z","html_url":"https://github.com/1-z","followers_url":"https://api.github.com/users/1-z/followers","following_url":"https://api.github.com/users/1-z/following{/other_user}","gists_url":"https://api.github.com/users/1-z/gists{/gist_id}","starred_url":"https://api.github.com/users/1-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1-z/subscriptions","organizations_url":"https://api.github.com/users/1-z/orgs","repos_url":"https://api.github.com/users/1-z/repos","events_url":"https://api.github.com/users/1-z/events{/privacy}","received_events_url":"https://api.github.com/users/1-z/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/1-z/rules_go","description":"Go rules for Bazel","fork":true,"url":"https://api.github.com/repos/1-z/rules_go","forks_url":"https://api.github.com/repos/1-z/rules_go/forks","keys_url":"https://api.github.com/repos/1-z/rules_go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/1-z/rules_go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/1-z/rules_go/teams","hooks_url":"https://api.github.com/repos/1-z/rules_go/hooks","issue_events_url":"https://api.github.com/repos/1-z/rules_go/issues/events{/number}","events_url":"https://api.github.com/repos/1-z/rules_go/events","assignees_url":"https://api.github.com/repos/1-z/rules_go/assignees{/user}","branches_url":"https://api.github.com/repos/1-z/rules_go/branches{/branch}","tags_url":"https://api.github.com/repos/1-z/rules_go/tags","blobs_url":"https://api.github.com/repos/1-z/rules_go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/1-z/rules_go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/1-z/rules_go/git/refs{/sha}","trees_url":"https://api.github.com/repos/1-z/rules_go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/1-z/rules_go/statuses/{sha}","languages_url":"https://api.github.com/repos/1-z/rules_go/languages","stargazers_url":"https://api.github.com/repos/1-z/rules_go/stargazers","contributors_url":"https://api.github.com/repos/1-z/rules_go/contributors","subscribers_url":"https://api.github.com/repos/1-z/rules_go/subscribers","subscription_url":"https://api.github.com/repos/1-z/rules_go/subscription","commits_url":"https://api.github.com/repos/1-z/rules_go/commits{/sha}","git_commits_url":"https://api.github.com/repos/1-z/rules_go/git/commits{/sha}","comments_url":"https://api.github.com/repos/1-z/rules_go/comments{/number}","issue_comment_url":"https://api.github.com/repos/1-z/rules_go/issues/comments{/number}","contents_url":"https://api.github.com/repos/1-z/rules_go/contents/{+path}","compare_url":"https://api.github.com/repos/1-z/rules_go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/1-z/rules_go/merges","archive_url":"https://api.github.com/repos/1-z/rules_go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/1-z/rules_go/downloads","issues_url":"https://api.github.com/repos/1-z/rules_go/issues{/number}","pulls_url":"https://api.github.com/repos/1-z/rules_go/pulls{/number}","milestones_url":"https://api.github.com/repos/1-z/rules_go/milestones{/number}","notifications_url":"https://api.github.com/repos/1-z/rules_go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/1-z/rules_go/labels{/name}","releases_url":"https://api.github.com/repos/1-z/rules_go/releases{/id}","deployments_url":"https://api.github.com/repos/1-z/rules_go/deployments","created_at":"2016-11-18T23:07:31Z","updated_at":"2016-11-18T23:07:32Z","pushed_at":"2016-11-28T18:40:56Z","git_url":"git://github.com/1-z/rules_go.git","ssh_url":"git@github.com:1-z/rules_go.git","clone_url":"https://github.com/1-z/rules_go.git","svn_url":"https://github.com/1-z/rules_go","homepage":null,"size":274,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"5c67e20c6d3171ffb0353d625bfa19b9db61874b","user":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars.githubusercontent.com/u/11684617?v=3","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"repo":{"id":53954979,"name":"rules_go","full_name":"bazelbuild/rules_go","owner":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars.githubusercontent.com/u/11684617?v=3","gravatar_id":"","url":"https://api.github.com/users/bazelbuild","html_url":"https://github.com/bazelbuild","followers_url":"https://api.github.com/users/bazelbuild/followers","following_url":"https://api.github.com/users/bazelbuild/following{/other_user}","gists_url":"https://api.github.com/users/bazelbuild/gists{/gist_id}","starred_url":"https://api.github.com/users/bazelbuild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazelbuild/subscriptions","organizations_url":"https://api.github.com/users/bazelbuild/orgs","repos_url":"https://api.github.com/users/bazelbuild/repos","events_url":"https://api.github.com/users/bazelbuild/events{/privacy}","received_events_url":"https://api.github.com/users/bazelbuild/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bazelbuild/rules_go","description":"Go rules for Bazel","fork":false,"url":"https://api.github.com/repos/bazelbuild/rules_go","forks_url":"https://api.github.com/repos/bazelbuild/rules_go/forks","keys_url":"https://api.github.com/repos/bazelbuild/rules_go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bazelbuild/rules_go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bazelbuild/rules_go/teams","hooks_url":"https://api.github.com/repos/bazelbuild/rules_go/hooks","issue_events_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/events{/number}","events_url":"https://api.github.com/repos/bazelbuild/rules_go/events","assignees_url":"https://api.github.com/repos/bazelbuild/rules_go/assignees{/user}","branches_url":"https://api.github.com/repos/bazelbuild/rules_go/branches{/branch}","tags_url":"https://api.github.com/repos/bazelbuild/rules_go/tags","blobs_url":"https://api.github.com/repos/bazelbuild/rules_go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bazelbuild/rules_go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bazelbuild/rules_go/git/refs{/sha}","trees_url":"https://api.github.com/repos/bazelbuild/rules_go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bazelbuild/rules_go/statuses/{sha}","languages_url":"https://api.github.com/repos/bazelbuild/rules_go/languages","stargazers_url":"https://api.github.com/repos/bazelbuild/rules_go/stargazers","contributors_url":"https://api.github.com/repos/bazelbuild/rules_go/contributors","subscribers_url":"https://api.github.com/repos/bazelbuild/rules_go/subscribers","subscription_url":"https://api.github.com/repos/bazelbuild/rules_go/subscription","commits_url":"https://api.github.com/repos/bazelbuild/rules_go/commits{/sha}","git_commits_url":"https://api.github.com/repos/bazelbuild/rules_go/git/commits{/sha}","comments_url":"https://api.github.com/repos/bazelbuild/rules_go/comments{/number}","issue_comment_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/comments{/number}","contents_url":"https://api.github.com/repos/bazelbuild/rules_go/contents/{+path}","compare_url":"https://api.github.com/repos/bazelbuild/rules_go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bazelbuild/rules_go/merges","archive_url":"https://api.github.com/repos/bazelbuild/rules_go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bazelbuild/rules_go/downloads","issues_url":"https://api.github.com/repos/bazelbuild/rules_go/issues{/number}","pulls_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls{/number}","milestones_url":"https://api.github.com/repos/bazelbuild/rules_go/milestones{/number}","notifications_url":"https://api.github.com/repos/bazelbuild/rules_go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bazelbuild/rules_go/labels{/name}","releases_url":"https://api.github.com/repos/bazelbuild/rules_go/releases{/id}","deployments_url":"https://api.github.com/repos/bazelbuild/rules_go/deployments","created_at":"2016-03-15T15:15:14Z","updated_at":"2016-11-27T05:30:00Z","pushed_at":"2016-11-28T18:40:56Z","git_url":"git://github.com/bazelbuild/rules_go.git","ssh_url":"git@github.com:bazelbuild/rules_go.git","clone_url":"https://github.com/bazelbuild/rules_go.git","svn_url":"https://github.com/bazelbuild/rules_go","homepage":null,"size":479,"stargazers_count":46,"watchers_count":46,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":44,"forks":37,"open_issues":44,"watchers":46,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200"},"html":{"href":"https://github.com/bazelbuild/rules_go/pull/200"},"issue":{"href":"https://api.github.com/repos/bazelbuild/rules_go/issues/200"},"comments":{"href":"https://api.github.com/repos/bazelbuild/rules_go/issues/200/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200/comments"},"review_comment":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/200/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/rules_go/statuses/622d080939d42832dbcf30b7dcc4fec539120c0a"}}}}
{"actor":{"display_login":"1-z"}}