{"action":"created","comment":{"url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments/151538604","pull_request_review_id":77264784,"id":151538604,"diff_hunk":"@@ -88,13 +90,13 @@ def emit_archive(ctx, go_toolchain, mode=None, golib=None, goembed=None, direct=\n   for src in source.asm:\n     obj = ctx.actions.declare_file(\"{}/{}.o\".format(out_dir, src.basename[:-2]))\n     go_toolchain.actions.asm(ctx, go_toolchain, mode=mode, source=src, hdrs=source.headers, out_obj=obj)\n-    extra_objects += [obj]\n+    extra_objects.append(obj)\n   archive = goembed.cgo_info.archive if goembed.cgo_info else None\n \n   transitive = direct\n   for a in direct:\n     if a.mode != mode: fail(\"Archive mode does not match {} is {} expected {}\".format(a.library.label, mode_string(a.mode), mode_string(mode)))\n-    transitive += a.transitive\n+    transitive = sets.union(transitive, a.transitive)","path":"go/private/actions/archive.bzl","position":21,"original_position":21,"commit_id":"6875c2b8ea9c999b2f0fb8d83adb35133b41ca22","original_commit_id":"6875c2b8ea9c999b2f0fb8d83adb35133b41ca22","user":{"login":"jayconrod","id":164791,"avatar_url":"https://avatars3.githubusercontent.com/u/164791?v=4","gravatar_id":"","url":"https://api.github.com/users/jayconrod","html_url":"https://github.com/jayconrod","followers_url":"https://api.github.com/users/jayconrod/followers","following_url":"https://api.github.com/users/jayconrod/following{/other_user}","gists_url":"https://api.github.com/users/jayconrod/gists{/gist_id}","starred_url":"https://api.github.com/users/jayconrod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayconrod/subscriptions","organizations_url":"https://api.github.com/users/jayconrod/orgs","repos_url":"https://api.github.com/users/jayconrod/repos","events_url":"https://api.github.com/users/jayconrod/events{/privacy}","received_events_url":"https://api.github.com/users/jayconrod/received_events","type":"User","site_admin":false},"body":"> I thought that Bazel only did de-duplication when a depset is collapsed back to a list rather than on construction?\r\n\r\nSadly, that is not the case. See the constructor in [SkylarkNestedSet.java](https://github.com/bazelbuild/bazel/blob/17cb02dc4dad4a6bad59bc08d9789a3a0e5a17fe/src/main/java/com/google/devtools/build/lib/syntax/SkylarkNestedSet.java#L119). I was looking through this yesterday to understand why it was hashing things added to the set. Nothing in here worked the way I expected.\r\n\r\nNote that this only de-duplicates the combined list of direct values and the combined list of transitive depsets. It doesn't look at the contents of the transitive depsets.\r\n\r\n> And even then, we ought to change union to use the new depset constructor rather than repeated +=\r\n> sets.union should always be the best answer for how to union a bunch of sets :)\r\n\r\nAgreed, but I'm not sure what their minimum supported Bazel version is. The depset constructor was new in Bazel 0.7 (the first revision of my PR yesterday broke on 0.6). In any case, sets.union will still be slower than necessary when it's called in a loop. It will be better to build a list of depsets, then call sets.union on all of them. It should be implemented like this:\r\n\r\n```\r\ndef _union(*args):\r\n  for i, arg in enumerate(args):\r\n    if type(arg) != \"depset\":\r\n      args[i] = depset(args)\r\n  return depset(transitive = args)\r\n```\r\n","created_at":"2017-11-16T21:14:27Z","updated_at":"2017-11-16T21:14:27Z","html_url":"https://github.com/bazelbuild/rules_go/pull/1029#discussion_r151538604","pull_request_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/comments/151538604"},"html":{"href":"https://github.com/bazelbuild/rules_go/pull/1029#discussion_r151538604"},"pull_request":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029"}},"in_reply_to_id":151487321},"pull_request":{"url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029","id":152955531,"html_url":"https://github.com/bazelbuild/rules_go/pull/1029","diff_url":"https://github.com/bazelbuild/rules_go/pull/1029.diff","patch_url":"https://github.com/bazelbuild/rules_go/pull/1029.patch","issue_url":"https://api.github.com/repos/bazelbuild/rules_go/issues/1029","number":1029,"state":"open","locked":false,"title":"Cleaning up lists, tuples and depsets","user":{"login":"ianthehat","id":858832,"avatar_url":"https://avatars0.githubusercontent.com/u/858832?v=4","gravatar_id":"","url":"https://api.github.com/users/ianthehat","html_url":"https://github.com/ianthehat","followers_url":"https://api.github.com/users/ianthehat/followers","following_url":"https://api.github.com/users/ianthehat/following{/other_user}","gists_url":"https://api.github.com/users/ianthehat/gists{/gist_id}","starred_url":"https://api.github.com/users/ianthehat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianthehat/subscriptions","organizations_url":"https://api.github.com/users/ianthehat/orgs","repos_url":"https://api.github.com/users/ianthehat/repos","events_url":"https://api.github.com/users/ianthehat/events{/privacy}","received_events_url":"https://api.github.com/users/ianthehat/received_events","type":"User","site_admin":false},"body":"Much less bouncing between them.\r\nAlso, no more ambiguious += statements\r\nAll in the name of performance,","created_at":"2017-11-16T05:38:23Z","updated_at":"2017-11-16T21:14:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb694c139a7e7ace36674c49bf1c086fc22623a9","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029/commits","review_comments_url":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029/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/1029/comments","statuses_url":"https://api.github.com/repos/bazelbuild/rules_go/statuses/6875c2b8ea9c999b2f0fb8d83adb35133b41ca22","head":{"label":"ianthehat:faster","ref":"faster","sha":"6875c2b8ea9c999b2f0fb8d83adb35133b41ca22","user":{"login":"ianthehat","id":858832,"avatar_url":"https://avatars0.githubusercontent.com/u/858832?v=4","gravatar_id":"","url":"https://api.github.com/users/ianthehat","html_url":"https://github.com/ianthehat","followers_url":"https://api.github.com/users/ianthehat/followers","following_url":"https://api.github.com/users/ianthehat/following{/other_user}","gists_url":"https://api.github.com/users/ianthehat/gists{/gist_id}","starred_url":"https://api.github.com/users/ianthehat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianthehat/subscriptions","organizations_url":"https://api.github.com/users/ianthehat/orgs","repos_url":"https://api.github.com/users/ianthehat/repos","events_url":"https://api.github.com/users/ianthehat/events{/privacy}","received_events_url":"https://api.github.com/users/ianthehat/received_events","type":"User","site_admin":false},"repo":{"id":85199725,"name":"rules_go","full_name":"ianthehat/rules_go","owner":{"login":"ianthehat","id":858832,"avatar_url":"https://avatars0.githubusercontent.com/u/858832?v=4","gravatar_id":"","url":"https://api.github.com/users/ianthehat","html_url":"https://github.com/ianthehat","followers_url":"https://api.github.com/users/ianthehat/followers","following_url":"https://api.github.com/users/ianthehat/following{/other_user}","gists_url":"https://api.github.com/users/ianthehat/gists{/gist_id}","starred_url":"https://api.github.com/users/ianthehat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianthehat/subscriptions","organizations_url":"https://api.github.com/users/ianthehat/orgs","repos_url":"https://api.github.com/users/ianthehat/repos","events_url":"https://api.github.com/users/ianthehat/events{/privacy}","received_events_url":"https://api.github.com/users/ianthehat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ianthehat/rules_go","description":"Go rules for Bazel","fork":true,"url":"https://api.github.com/repos/ianthehat/rules_go","forks_url":"https://api.github.com/repos/ianthehat/rules_go/forks","keys_url":"https://api.github.com/repos/ianthehat/rules_go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianthehat/rules_go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianthehat/rules_go/teams","hooks_url":"https://api.github.com/repos/ianthehat/rules_go/hooks","issue_events_url":"https://api.github.com/repos/ianthehat/rules_go/issues/events{/number}","events_url":"https://api.github.com/repos/ianthehat/rules_go/events","assignees_url":"https://api.github.com/repos/ianthehat/rules_go/assignees{/user}","branches_url":"https://api.github.com/repos/ianthehat/rules_go/branches{/branch}","tags_url":"https://api.github.com/repos/ianthehat/rules_go/tags","blobs_url":"https://api.github.com/repos/ianthehat/rules_go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianthehat/rules_go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianthehat/rules_go/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianthehat/rules_go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianthehat/rules_go/statuses/{sha}","languages_url":"https://api.github.com/repos/ianthehat/rules_go/languages","stargazers_url":"https://api.github.com/repos/ianthehat/rules_go/stargazers","contributors_url":"https://api.github.com/repos/ianthehat/rules_go/contributors","subscribers_url":"https://api.github.com/repos/ianthehat/rules_go/subscribers","subscription_url":"https://api.github.com/repos/ianthehat/rules_go/subscription","commits_url":"https://api.github.com/repos/ianthehat/rules_go/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianthehat/rules_go/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianthehat/rules_go/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianthehat/rules_go/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianthehat/rules_go/contents/{+path}","compare_url":"https://api.github.com/repos/ianthehat/rules_go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianthehat/rules_go/merges","archive_url":"https://api.github.com/repos/ianthehat/rules_go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianthehat/rules_go/downloads","issues_url":"https://api.github.com/repos/ianthehat/rules_go/issues{/number}","pulls_url":"https://api.github.com/repos/ianthehat/rules_go/pulls{/number}","milestones_url":"https://api.github.com/repos/ianthehat/rules_go/milestones{/number}","notifications_url":"https://api.github.com/repos/ianthehat/rules_go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianthehat/rules_go/labels{/name}","releases_url":"https://api.github.com/repos/ianthehat/rules_go/releases{/id}","deployments_url":"https://api.github.com/repos/ianthehat/rules_go/deployments","created_at":"2017-03-16T13:35:25Z","updated_at":"2017-07-06T13:26:12Z","pushed_at":"2017-11-16T16:40:50Z","git_url":"git://github.com/ianthehat/rules_go.git","ssh_url":"git@github.com:ianthehat/rules_go.git","clone_url":"https://github.com/ianthehat/rules_go.git","svn_url":"https://github.com/ianthehat/rules_go","homepage":null,"size":1462,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"bazelbuild:master","ref":"master","sha":"ae4550f6995fe6f293e67e8301fceedb0682108c","user":{"login":"bazelbuild","id":11684617,"avatar_url":"https://avatars1.githubusercontent.com/u/11684617?v=4","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://avatars1.githubusercontent.com/u/11684617?v=4","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":"2017-11-14T05:50:34Z","pushed_at":"2017-11-16T16:40:51Z","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":1467,"stargazers_count":184,"watchers_count":184,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":120,"mirror_url":null,"archived":false,"open_issues_count":138,"forks":120,"open_issues":138,"watchers":184,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029"},"html":{"href":"https://github.com/bazelbuild/rules_go/pull/1029"},"issue":{"href":"https://api.github.com/repos/bazelbuild/rules_go/issues/1029"},"comments":{"href":"https://api.github.com/repos/bazelbuild/rules_go/issues/1029/comments"},"review_comments":{"href":"https://api.github.com/repos/bazelbuild/rules_go/pulls/1029/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/1029/commits"},"statuses":{"href":"https://api.github.com/repos/bazelbuild/rules_go/statuses/6875c2b8ea9c999b2f0fb8d83adb35133b41ca22"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jayconrod"}}