{"action":"created","comment":{"url":"https://api.github.com/repos/uber-go/dig/pulls/comments/210764624","pull_request_review_id":147051365,"id":210764624,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDc2NDYyNA==","diff_hunk":"@@ -0,0 +1,319 @@\n+// Copyright (c) 2018 Uber Technologies, Inc.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a copy\n+// of this software and associated documentation files (the \"Software\"), to deal\n+// in the Software without restriction, including without limitation the rights\n+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+// copies of the Software, and to permit persons to whom the Software is\n+// furnished to do so, subject to the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+// THE SOFTWARE.\n+\n+package dot\n+\n+import (\n+\t\"fmt\"\n+\t\"reflect\"\n+)\n+\n+// ErrorType of a constructor or group is updated when they fail to build.\n+type ErrorType int\n+\n+const (\n+\tnoError ErrorType = iota\n+\trootCause\n+\ttransitiveFailure\n+)\n+\n+// CtorID is a unique numeric identifier for constructors.\n+type CtorID uintptr\n+\n+// Ctor encodes a constructor provided to the container for the DOT graph.\n+type Ctor struct {\n+\tName        string\n+\tPackage     string\n+\tFile        string\n+\tLine        int\n+\tID          CtorID\n+\tParams      []*Param\n+\tGroupParams []*Group\n+\tResults     []*Result\n+\tErrorType   ErrorType\n+}\n+\n+// Node is a single node in a graph and is embedded into Params and Results.\n+type Node struct {\n+\tType  reflect.Type\n+\tName  string\n+\tGroup string\n+}\n+\n+// Param is a parameter node in the graph.\n+type Param struct {\n+\t*Node\n+\n+\tOptional bool\n+}\n+\n+// Result is a result node in the graph.\n+type Result struct {\n+\t*Node\n+\n+\t// GroupIndex is added to differentiate grouped values from one another.\n+\t// Since grouped values have the same type and group, their Node / string\n+\t// representations are the same so we need indices to uniquely identify\n+\t// the values.\n+\tGroupIndex int\n+}\n+\n+// Group is a group node in the graph.\n+type Group struct {\n+\t// Type is the type of values in the group.\n+\tType      reflect.Type\n+\tName      string\n+\tResults   []*Result\n+\tErrorType ErrorType\n+}\n+\n+// Graph is the DOT-format graph in a Container.\n+type Graph struct {\n+\tCtors   []*Ctor\n+\tctorMap map[CtorID]*Ctor\n+\n+\tGroups   []*Group\n+\tgroupMap map[groupKey]*Group\n+\n+\tFailed *FailedNodes\n+}\n+\n+// FailedNodes is the nodes that failed in the graph.\n+type FailedNodes struct {\n+\t// RootCauses is a list of the point of failures. They are the root causes\n+\t// of failed invokes and can be either missing types (not provided) or\n+\t// error types (error providing).\n+\tRootCauses []*Result","path":"internal/dot/graph.go","position":103,"original_position":103,"commit_id":"6a9eccc9f0fa6d851335dc478d070c24abf27380","original_commit_id":"6a9eccc9f0fa6d851335dc478d070c24abf27380","user":{"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},"body":"I could be mistaken, but it appears that there will only ever be a single `RootCause` - appending to the internal slice is guarded by a `isRootCause := len(dg.Failed.RootCauses) == 0`. I don't think we need a slice in this case.\r\n\r\nThis is not at all actionable - things will work exactly the same regardless :)","created_at":"2018-08-16T22:52:37Z","updated_at":"2018-08-16T22:52:37Z","html_url":"https://github.com/uber-go/dig/pull/205#discussion_r210764624","pull_request_url":"https://api.github.com/repos/uber-go/dig/pulls/205","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/uber-go/dig/pulls/comments/210764624"},"html":{"href":"https://github.com/uber-go/dig/pull/205#discussion_r210764624"},"pull_request":{"href":"https://api.github.com/repos/uber-go/dig/pulls/205"}}},"pull_request":{"url":"https://api.github.com/repos/uber-go/dig/pulls/205","id":208997768,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4OTk3NzY4","html_url":"https://github.com/uber-go/dig/pull/205","diff_url":"https://github.com/uber-go/dig/pull/205.diff","patch_url":"https://github.com/uber-go/dig/pull/205.patch","issue_url":"https://api.github.com/repos/uber-go/dig/issues/205","number":205,"state":"open","locked":false,"title":"dot: graph representation of dependency relations in container","user":{"login":"leyao","id":14879114,"node_id":"MDQ6VXNlcjE0ODc5MTE0","avatar_url":"https://avatars2.githubusercontent.com/u/14879114?v=4","gravatar_id":"","url":"https://api.github.com/users/leyao","html_url":"https://github.com/leyao","followers_url":"https://api.github.com/users/leyao/followers","following_url":"https://api.github.com/users/leyao/following{/other_user}","gists_url":"https://api.github.com/users/leyao/gists{/gist_id}","starred_url":"https://api.github.com/users/leyao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leyao/subscriptions","organizations_url":"https://api.github.com/users/leyao/orgs","repos_url":"https://api.github.com/users/leyao/repos","events_url":"https://api.github.com/users/leyao/events{/privacy}","received_events_url":"https://api.github.com/users/leyao/received_events","type":"User","site_admin":false},"body":"`Visualize` function visualizes the state of the container in the GraphViz DOT format. This is useful for debugging application startup failures as it allows the visualization of error types and the dependency relations of types in the container.","created_at":"2018-08-16T22:06:50Z","updated_at":"2018-08-16T22:52:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bdfc23af35404f4667d433b0994fe931650bc1e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"abhinav","id":41730,"node_id":"MDQ6VXNlcjQxNzMw","avatar_url":"https://avatars0.githubusercontent.com/u/41730?v=4","gravatar_id":"","url":"https://api.github.com/users/abhinav","html_url":"https://github.com/abhinav","followers_url":"https://api.github.com/users/abhinav/followers","following_url":"https://api.github.com/users/abhinav/following{/other_user}","gists_url":"https://api.github.com/users/abhinav/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinav/subscriptions","organizations_url":"https://api.github.com/users/abhinav/orgs","repos_url":"https://api.github.com/users/abhinav/repos","events_url":"https://api.github.com/users/abhinav/events{/privacy}","received_events_url":"https://api.github.com/users/abhinav/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uber-go/dig/pulls/205/commits","review_comments_url":"https://api.github.com/repos/uber-go/dig/pulls/205/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/205/comments","statuses_url":"https://api.github.com/repos/uber-go/dig/statuses/6a9eccc9f0fa6d851335dc478d070c24abf27380","head":{"label":"uber-go:feature/graphviz","ref":"feature/graphviz","sha":"6a9eccc9f0fa6d851335dc478d070c24abf27380","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","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},"private":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-08-15T23:46:47Z","pushed_at":"2018-08-16T22:26: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":452,"stargazers_count":310,"watchers_count":310,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14,"open_issues":10,"watchers":310,"default_branch":"master"}},"base":{"label":"uber-go:master","ref":"master","sha":"9b2360b34259248adbcf16a1f61ec7750ff19d33","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","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},"private":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-08-15T23:46:47Z","pushed_at":"2018-08-16T22:26: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":452,"stargazers_count":310,"watchers_count":310,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14,"open_issues":10,"watchers":310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber-go/dig/pulls/205"},"html":{"href":"https://github.com/uber-go/dig/pull/205"},"issue":{"href":"https://api.github.com/repos/uber-go/dig/issues/205"},"comments":{"href":"https://api.github.com/repos/uber-go/dig/issues/205/comments"},"review_comments":{"href":"https://api.github.com/repos/uber-go/dig/pulls/205/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/205/commits"},"statuses":{"href":"https://api.github.com/repos/uber-go/dig/statuses/6a9eccc9f0fa6d851335dc478d070c24abf27380"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"amckinney"}}