{"action":"created","comment":{"url":"https://api.github.com/repos/uber-go/dig/pulls/comments/230503232","pull_request_review_id":171264930,"id":230503232,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDUwMzIzMg==","diff_hunk":"@@ -252,6 +274,59 @@ func (dg *Graph) addToGroup(r *Result, id CtorID) {\n \tgroup.Results = append(group.Results, r)\n }\n \n+// Prune removes elements from the graph that do not have failed results.\n+// Removing elements that do not have failing results makes the graph easier to debug, since non-failing\n+// nodes and edges can clutter the graph and don't help the user debug.\n+func (dg *Graph) Prune() {\n+\tdg.pruneCtors()\n+\tdg.pruneGroups()\n+}\n+\n+// Remove constructors from the graph that do not have failing Results.\n+func (dg *Graph) pruneCtors() {\n+\tvar prunedCtors []*Ctor\n+\tfor _, c := range dg.Ctors {\n+\t\tif _, ok := dg.Failed.FailedCtors[c.ID]; ok {\n+\t\t\tprunedCtors = append(prunedCtors, c)\n+\t\t} else {\n+\t\t\tdg.pruneGroupResults(c)\n+\t\t\tdelete(dg.ctorMap, c.ID)\n+\t\t}\n+\t}\n+\n+\tdg.Ctors = prunedCtors\n+}\n+\n+// Remove groups from the graph that do not have failing Results.\n+func (dg *Graph) pruneGroups() {\n+\tvar prunedGroups []*Group\n+\tfor _, g := range dg.Groups {\n+\t\tif _, ok := dg.Failed.FailedGroups[groupKey{t: g.Type, group: g.Name}]; ok {\n+\t\t\tprunedGroups = append(prunedGroups, g)\n+\t\t} else {\n+\t\t\tdelete(dg.groupMap, groupKey{t: g.Type, group: g.Name})\n+\t\t}\n+\t}\n+\n+\tdg.Groups = prunedGroups\n+}\n+\n+// PruneGroupResults removes constructor results that are still referenced in\n+// their respective Group object.\n+func (dg *Graph) pruneGroupResults(c *Ctor) {\n+\tfor _, r := range c.Results {\n+\t\tvar prunedResults []*Result\n+\t\tif resultGroup, ok := dg.groupMap[r.groupKey()]; ok {\n+\t\t\tfor _, gr := range resultGroup.Results {\n+\t\t\t\tif r.GroupIndex != gr.GroupIndex {\n+\t\t\t\t\tprunedResults = append(prunedResults, gr)\n+\t\t\t\t}","path":"internal/dot/graph.go","position":null,"original_position":128,"commit_id":"4ac514aa4c7c2eb4816cad2b2eafd52f079b9456","original_commit_id":"bc3c7e0583238c6d4d37c90b2944d7344a9527b0","user":{"login":"rhang-uber","id":42982339,"node_id":"MDQ6VXNlcjQyOTgyMzM5","avatar_url":"https://avatars3.githubusercontent.com/u/42982339?v=4","gravatar_id":"","url":"https://api.github.com/users/rhang-uber","html_url":"https://github.com/rhang-uber","followers_url":"https://api.github.com/users/rhang-uber/followers","following_url":"https://api.github.com/users/rhang-uber/following{/other_user}","gists_url":"https://api.github.com/users/rhang-uber/gists{/gist_id}","starred_url":"https://api.github.com/users/rhang-uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhang-uber/subscriptions","organizations_url":"https://api.github.com/users/rhang-uber/orgs","repos_url":"https://api.github.com/users/rhang-uber/repos","events_url":"https://api.github.com/users/rhang-uber/events{/privacy}","received_events_url":"https://api.github.com/users/rhang-uber/received_events","type":"User","site_admin":false},"body":"Will add these changes to the grafx: The next generation ticket!","created_at":"2018-11-02T20:45:03Z","updated_at":"2018-11-02T20:45:04Z","html_url":"https://github.com/uber-go/dig/pull/218#discussion_r230503232","pull_request_url":"https://api.github.com/repos/uber-go/dig/pulls/218","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/uber-go/dig/pulls/comments/230503232"},"html":{"href":"https://github.com/uber-go/dig/pull/218#discussion_r230503232"},"pull_request":{"href":"https://api.github.com/repos/uber-go/dig/pulls/218"}},"in_reply_to_id":229506107},"pull_request":{"url":"https://api.github.com/repos/uber-go/dig/pulls/218","id":225951406,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1OTUxNDA2","html_url":"https://github.com/uber-go/dig/pull/218","diff_url":"https://github.com/uber-go/dig/pull/218.diff","patch_url":"https://github.com/uber-go/dig/pull/218.patch","issue_url":"https://api.github.com/repos/uber-go/dig/issues/218","number":218,"state":"open","locked":false,"title":"Add the ability to prune non-error entries out of the graph","user":{"login":"rhang-uber","id":42982339,"node_id":"MDQ6VXNlcjQyOTgyMzM5","avatar_url":"https://avatars3.githubusercontent.com/u/42982339?v=4","gravatar_id":"","url":"https://api.github.com/users/rhang-uber","html_url":"https://github.com/rhang-uber","followers_url":"https://api.github.com/users/rhang-uber/followers","following_url":"https://api.github.com/users/rhang-uber/following{/other_user}","gists_url":"https://api.github.com/users/rhang-uber/gists{/gist_id}","starred_url":"https://api.github.com/users/rhang-uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhang-uber/subscriptions","organizations_url":"https://api.github.com/users/rhang-uber/orgs","repos_url":"https://api.github.com/users/rhang-uber/repos","events_url":"https://api.github.com/users/rhang-uber/events{/privacy}","received_events_url":"https://api.github.com/users/rhang-uber/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-26T01:32:22Z","updated_at":"2018-11-02T20:45:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88d2694151cbef15066cc812cc4e09316e5664d4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"amckinney","id":5760684,"node_id":"MDQ6VXNlcjU3NjA2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5760684?v=4","gravatar_id":"","url":"https://api.github.com/users/amckinney","html_url":"https://github.com/amckinney","followers_url":"https://api.github.com/users/amckinney/followers","following_url":"https://api.github.com/users/amckinney/following{/other_user}","gists_url":"https://api.github.com/users/amckinney/gists{/gist_id}","starred_url":"https://api.github.com/users/amckinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amckinney/subscriptions","organizations_url":"https://api.github.com/users/amckinney/orgs","repos_url":"https://api.github.com/users/amckinney/repos","events_url":"https://api.github.com/users/amckinney/events{/privacy}","received_events_url":"https://api.github.com/users/amckinney/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uber-go/dig/pulls/218/commits","review_comments_url":"https://api.github.com/repos/uber-go/dig/pulls/218/comments","review_comment_url":"https://api.github.com/repos/uber-go/dig/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber-go/dig/issues/218/comments","statuses_url":"https://api.github.com/repos/uber-go/dig/statuses/4ac514aa4c7c2eb4816cad2b2eafd52f079b9456","head":{"label":"rhang-uber:rhang/prune-grafx-graph","ref":"rhang/prune-grafx-graph","sha":"4ac514aa4c7c2eb4816cad2b2eafd52f079b9456","user":{"login":"rhang-uber","id":42982339,"node_id":"MDQ6VXNlcjQyOTgyMzM5","avatar_url":"https://avatars3.githubusercontent.com/u/42982339?v=4","gravatar_id":"","url":"https://api.github.com/users/rhang-uber","html_url":"https://github.com/rhang-uber","followers_url":"https://api.github.com/users/rhang-uber/followers","following_url":"https://api.github.com/users/rhang-uber/following{/other_user}","gists_url":"https://api.github.com/users/rhang-uber/gists{/gist_id}","starred_url":"https://api.github.com/users/rhang-uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhang-uber/subscriptions","organizations_url":"https://api.github.com/users/rhang-uber/orgs","repos_url":"https://api.github.com/users/rhang-uber/repos","events_url":"https://api.github.com/users/rhang-uber/events{/privacy}","received_events_url":"https://api.github.com/users/rhang-uber/received_events","type":"User","site_admin":false},"repo":{"id":154759975,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ3NTk5NzU=","name":"dig","full_name":"rhang-uber/dig","private":false,"owner":{"login":"rhang-uber","id":42982339,"node_id":"MDQ6VXNlcjQyOTgyMzM5","avatar_url":"https://avatars3.githubusercontent.com/u/42982339?v=4","gravatar_id":"","url":"https://api.github.com/users/rhang-uber","html_url":"https://github.com/rhang-uber","followers_url":"https://api.github.com/users/rhang-uber/followers","following_url":"https://api.github.com/users/rhang-uber/following{/other_user}","gists_url":"https://api.github.com/users/rhang-uber/gists{/gist_id}","starred_url":"https://api.github.com/users/rhang-uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhang-uber/subscriptions","organizations_url":"https://api.github.com/users/rhang-uber/orgs","repos_url":"https://api.github.com/users/rhang-uber/repos","events_url":"https://api.github.com/users/rhang-uber/events{/privacy}","received_events_url":"https://api.github.com/users/rhang-uber/received_events","type":"User","site_admin":false},"html_url":"https://github.com/rhang-uber/dig","description":"A reflection based dependency injection toolkit for Go.","fork":true,"url":"https://api.github.com/repos/rhang-uber/dig","forks_url":"https://api.github.com/repos/rhang-uber/dig/forks","keys_url":"https://api.github.com/repos/rhang-uber/dig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhang-uber/dig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhang-uber/dig/teams","hooks_url":"https://api.github.com/repos/rhang-uber/dig/hooks","issue_events_url":"https://api.github.com/repos/rhang-uber/dig/issues/events{/number}","events_url":"https://api.github.com/repos/rhang-uber/dig/events","assignees_url":"https://api.github.com/repos/rhang-uber/dig/assignees{/user}","branches_url":"https://api.github.com/repos/rhang-uber/dig/branches{/branch}","tags_url":"https://api.github.com/repos/rhang-uber/dig/tags","blobs_url":"https://api.github.com/repos/rhang-uber/dig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhang-uber/dig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhang-uber/dig/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhang-uber/dig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhang-uber/dig/statuses/{sha}","languages_url":"https://api.github.com/repos/rhang-uber/dig/languages","stargazers_url":"https://api.github.com/repos/rhang-uber/dig/stargazers","contributors_url":"https://api.github.com/repos/rhang-uber/dig/contributors","subscribers_url":"https://api.github.com/repos/rhang-uber/dig/subscribers","subscription_url":"https://api.github.com/repos/rhang-uber/dig/subscription","commits_url":"https://api.github.com/repos/rhang-uber/dig/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhang-uber/dig/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhang-uber/dig/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhang-uber/dig/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhang-uber/dig/contents/{+path}","compare_url":"https://api.github.com/repos/rhang-uber/dig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhang-uber/dig/merges","archive_url":"https://api.github.com/repos/rhang-uber/dig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhang-uber/dig/downloads","issues_url":"https://api.github.com/repos/rhang-uber/dig/issues{/number}","pulls_url":"https://api.github.com/repos/rhang-uber/dig/pulls{/number}","milestones_url":"https://api.github.com/repos/rhang-uber/dig/milestones{/number}","notifications_url":"https://api.github.com/repos/rhang-uber/dig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhang-uber/dig/labels{/name}","releases_url":"https://api.github.com/repos/rhang-uber/dig/releases{/id}","deployments_url":"https://api.github.com/repos/rhang-uber/dig/deployments","created_at":"2018-10-26T01:31:02Z","updated_at":"2018-10-26T01:31:04Z","pushed_at":"2018-11-02T20:40:10Z","git_url":"git://github.com/rhang-uber/dig.git","ssh_url":"git@github.com:rhang-uber/dig.git","clone_url":"https://github.com/rhang-uber/dig.git","svn_url":"https://github.com/rhang-uber/dig","homepage":"https://go.uber.org/dig","size":431,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"uber-go:master","ref":"master","sha":"cc30ae73ae14aebd09c25f67268be689fc5f2512","user":{"login":"uber-go","id":19262598,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjYyNTk4","avatar_url":"https://avatars2.githubusercontent.com/u/19262598?v=4","gravatar_id":"","url":"https://api.github.com/users/uber-go","html_url":"https://github.com/uber-go","followers_url":"https://api.github.com/users/uber-go/followers","following_url":"https://api.github.com/users/uber-go/following{/other_user}","gists_url":"https://api.github.com/users/uber-go/gists{/gist_id}","starred_url":"https://api.github.com/users/uber-go/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber-go/subscriptions","organizations_url":"https://api.github.com/users/uber-go/orgs","repos_url":"https://api.github.com/users/uber-go/repos","events_url":"https://api.github.com/users/uber-go/events{/privacy}","received_events_url":"https://api.github.com/users/uber-go/received_events","type":"Organization","site_admin":false},"repo":{"id":85765458,"node_id":"MDEwOlJlcG9zaXRvcnk4NTc2NTQ1OA==","name":"dig","full_name":"uber-go/dig","private":false,"owner":{"login":"uber-go","id":19262598,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjYyNTk4","avatar_url":"https://avatars2.githubusercontent.com/u/19262598?v=4","gravatar_id":"","url":"https://api.github.com/users/uber-go","html_url":"https://github.com/uber-go","followers_url":"https://api.github.com/users/uber-go/followers","following_url":"https://api.github.com/users/uber-go/following{/other_user}","gists_url":"https://api.github.com/users/uber-go/gists{/gist_id}","starred_url":"https://api.github.com/users/uber-go/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber-go/subscriptions","organizations_url":"https://api.github.com/users/uber-go/orgs","repos_url":"https://api.github.com/users/uber-go/repos","events_url":"https://api.github.com/users/uber-go/events{/privacy}","received_events_url":"https://api.github.com/users/uber-go/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/uber-go/dig","description":"A reflection based dependency injection toolkit for Go.","fork":false,"url":"https://api.github.com/repos/uber-go/dig","forks_url":"https://api.github.com/repos/uber-go/dig/forks","keys_url":"https://api.github.com/repos/uber-go/dig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber-go/dig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber-go/dig/teams","hooks_url":"https://api.github.com/repos/uber-go/dig/hooks","issue_events_url":"https://api.github.com/repos/uber-go/dig/issues/events{/number}","events_url":"https://api.github.com/repos/uber-go/dig/events","assignees_url":"https://api.github.com/repos/uber-go/dig/assignees{/user}","branches_url":"https://api.github.com/repos/uber-go/dig/branches{/branch}","tags_url":"https://api.github.com/repos/uber-go/dig/tags","blobs_url":"https://api.github.com/repos/uber-go/dig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber-go/dig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber-go/dig/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber-go/dig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber-go/dig/statuses/{sha}","languages_url":"https://api.github.com/repos/uber-go/dig/languages","stargazers_url":"https://api.github.com/repos/uber-go/dig/stargazers","contributors_url":"https://api.github.com/repos/uber-go/dig/contributors","subscribers_url":"https://api.github.com/repos/uber-go/dig/subscribers","subscription_url":"https://api.github.com/repos/uber-go/dig/subscription","commits_url":"https://api.github.com/repos/uber-go/dig/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber-go/dig/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber-go/dig/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber-go/dig/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber-go/dig/contents/{+path}","compare_url":"https://api.github.com/repos/uber-go/dig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber-go/dig/merges","archive_url":"https://api.github.com/repos/uber-go/dig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber-go/dig/downloads","issues_url":"https://api.github.com/repos/uber-go/dig/issues{/number}","pulls_url":"https://api.github.com/repos/uber-go/dig/pulls{/number}","milestones_url":"https://api.github.com/repos/uber-go/dig/milestones{/number}","notifications_url":"https://api.github.com/repos/uber-go/dig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber-go/dig/labels{/name}","releases_url":"https://api.github.com/repos/uber-go/dig/releases{/id}","deployments_url":"https://api.github.com/repos/uber-go/dig/deployments","created_at":"2017-03-21T23:55:50Z","updated_at":"2018-11-02T09:20:30Z","pushed_at":"2018-11-02T20:40:12Z","git_url":"git://github.com/uber-go/dig.git","ssh_url":"git@github.com:uber-go/dig.git","clone_url":"https://github.com/uber-go/dig.git","svn_url":"https://github.com/uber-go/dig","homepage":"https://go.uber.org/dig","size":404,"stargazers_count":413,"watchers_count":413,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":24,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":24,"open_issues":9,"watchers":413,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber-go/dig/pulls/218"},"html":{"href":"https://github.com/uber-go/dig/pull/218"},"issue":{"href":"https://api.github.com/repos/uber-go/dig/issues/218"},"comments":{"href":"https://api.github.com/repos/uber-go/dig/issues/218/comments"},"review_comments":{"href":"https://api.github.com/repos/uber-go/dig/pulls/218/comments"},"review_comment":{"href":"https://api.github.com/repos/uber-go/dig/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber-go/dig/pulls/218/commits"},"statuses":{"href":"https://api.github.com/repos/uber-go/dig/statuses/4ac514aa4c7c2eb4816cad2b2eafd52f079b9456"}},"author_association":"NONE"}}
{"actor":{"display_login":"rhang-uber"}}