{"action":"created","comment":{"url":"https://api.github.com/repos/uber-go/dig/pulls/comments/194818890","pull_request_review_id":128062739,"id":194818890,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDgxODg5MA==","diff_hunk":"@@ -205,6 +207,36 @@ func New(opts ...Option) *Container {\n \treturn c\n }\n \n+// A VisualizeOption modifies the default behavior of Visualize. It's included\n+// for future functionality; currently, there are no concrete implementations.\n+type VisualizeOption interface {\n+\tunimplemented()\n+}\n+\n+// Visualize parses the graph in Container c into DOT format and writes it to\n+// io.Writer w.\n+func Visualize(c *Container, w io.Writer, opts ...VisualizeOption) error {\n+\tgraphTmpl := template.Must(template.New(\"DotGraph\").Parse(`digraph {\n+\tgraph [compound=true];","path":"dig.go","position":28,"original_position":28,"commit_id":"7c2f469713ef21fd0612d6cdc505061ef55d2863","original_commit_id":"7c2f469713ef21fd0612d6cdc505061ef55d2863","user":{"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},"body":"With the `template.Must` business, I suggest putting it in a package-level variable so it happens only once.\r\n\r\n```go\r\nvar _graphTmpl = template.Must(...)\r\n\r\nfunc Visualize(c *Container, ...) error {\r\n  if err := graphTmpl.Execute(w, c.dg); err != nil {\r\n    ...\r\n  }\r\n  return nil\r\n}\r\n```","created_at":"2018-06-12T17:09:48Z","updated_at":"2018-06-12T17:12:57Z","html_url":"https://github.com/uber-go/dig/pull/191#discussion_r194818890","pull_request_url":"https://api.github.com/repos/uber-go/dig/pulls/191","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/uber-go/dig/pulls/comments/194818890"},"html":{"href":"https://github.com/uber-go/dig/pull/191#discussion_r194818890"},"pull_request":{"href":"https://api.github.com/repos/uber-go/dig/pulls/191"}}},"pull_request":{"url":"https://api.github.com/repos/uber-go/dig/pulls/191","id":192535348,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNTM1MzQ4","html_url":"https://github.com/uber-go/dig/pull/191","diff_url":"https://github.com/uber-go/dig/pull/191.diff","patch_url":"https://github.com/uber-go/dig/pull/191.patch","issue_url":"https://api.github.com/repos/uber-go/dig/issues/191","number":191,"state":"open","locked":false,"title":"Visualize: Parse graph into DOT format","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":"Added `Visualize` method that takes in a `Container` object, parses its dependency graph into DOT format, and writes to an `io.Writer`.","created_at":"2018-06-04T21:37:07Z","updated_at":"2018-06-12T17:12:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71d5be1aad0821df1cc209a09e3a6a3ae46aef78","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uber-go/dig/pulls/191/commits","review_comments_url":"https://api.github.com/repos/uber-go/dig/pulls/191/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/191/comments","statuses_url":"https://api.github.com/repos/uber-go/dig/statuses/7c2f469713ef21fd0612d6cdc505061ef55d2863","head":{"label":"uber-go:leyao-visualize","ref":"leyao-visualize","sha":"7c2f469713ef21fd0612d6cdc505061ef55d2863","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-06-10T10:25:23Z","pushed_at":"2018-06-12T00:25:20Z","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":412,"stargazers_count":261,"watchers_count":261,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":10,"open_issues":9,"watchers":261,"default_branch":"master"}},"base":{"label":"uber-go:feature/graphviz","ref":"feature/graphviz","sha":"7b679811999e0a8e7dfbbeb204ff5b1a69da1da8","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-06-10T10:25:23Z","pushed_at":"2018-06-12T00:25:20Z","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":412,"stargazers_count":261,"watchers_count":261,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":10,"open_issues":9,"watchers":261,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber-go/dig/pulls/191"},"html":{"href":"https://github.com/uber-go/dig/pull/191"},"issue":{"href":"https://api.github.com/repos/uber-go/dig/issues/191"},"comments":{"href":"https://api.github.com/repos/uber-go/dig/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/uber-go/dig/pulls/191/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/191/commits"},"statuses":{"href":"https://api.github.com/repos/uber-go/dig/statuses/7c2f469713ef21fd0612d6cdc505061ef55d2863"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"abhinav"}}