{"action":"created","comment":{"url":"https://api.github.com/repos/admdwrf/ovhcli/pulls/comments/89400539","pull_request_review_id":9946532,"id":89400539,"diff_hunk":"@@ -25,15 +27,32 @@ var cmdDomainList = &cobra.Command{\n \t\tcommon.Check(err)\n \n \t\tif withDetails {\n-\t\t\tdomainsComplete := []ovh.Domain{}\n-\t\t\tfor _, domain := range domains {\n-\t\t\t\td, err := client.DomainInfo(domain.Domain)\n-\t\t\t\tcommon.Check(err)\n-\t\t\t\tdomainsComplete = append(domainsComplete, *d)\n-\t\t\t}\n-\t\t\tdomains = domainsComplete\n+\t\t\tdomains = getDetailledDomainList(client, domains)\n \t\t}\n \n \t\tcommon.FormatOutputDef(domains)\n \t},\n }\n+\n+func getDetailledDomainList(client *ovh.Client, domains []ovh.Domain) []ovh.Domain {\n+\tvar wg sync.WaitGroup\n+\twg.Add(len(domains))\n+\n+\tdomainsChan := make(chan ovh.Domain)\n+\tdomainsComplete := []ovh.Domain{}\n+\tfor _, domain := range domains {\n+\t\tgo func(domain ovh.Domain) {\n+\t\t\td, err := client.DomainInfo(domain.Domain)\n+\t\t\tcommon.Check(err)\n+\t\t\tdomainsChan <- *d\n+\t\t}(domain)\n+\t}\n+\tgo func() {\n+\t\tfor d := range domainsChan {\n+\t\t\tdomainsComplete = append(domainsComplete, d)\n+\t\t\twg.Done()","path":"ovhcli/domain/list.go","position":43,"original_position":43,"commit_id":"fff14e390ec3dfe6c982840fa2015813d0ed0e11","original_commit_id":"fff14e390ec3dfe6c982840fa2015813d0ed0e11","user":{"login":"fsamin","id":684151,"avatar_url":"https://avatars.githubusercontent.com/u/684151?v=3","gravatar_id":"","url":"https://api.github.com/users/fsamin","html_url":"https://github.com/fsamin","followers_url":"https://api.github.com/users/fsamin/followers","following_url":"https://api.github.com/users/fsamin/following{/other_user}","gists_url":"https://api.github.com/users/fsamin/gists{/gist_id}","starred_url":"https://api.github.com/users/fsamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsamin/subscriptions","organizations_url":"https://api.github.com/users/fsamin/orgs","repos_url":"https://api.github.com/users/fsamin/repos","events_url":"https://api.github.com/users/fsamin/events{/privacy}","received_events_url":"https://api.github.com/users/fsamin/received_events","type":"User","site_admin":false},"body":"you should not play with a non-pointer wg from closure scopes\r\nyou should pass pointer to wg as argument to goroutine closure, or declare wg as a pointer to sync.WaitGroup","created_at":"2016-11-23T21:18:44Z","updated_at":"2016-11-23T21:18:44Z","html_url":"https://github.com/admdwrf/ovhcli/pull/12#discussion_r89400539","pull_request_url":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/admdwrf/ovhcli/pulls/comments/89400539"},"html":{"href":"https://github.com/admdwrf/ovhcli/pull/12#discussion_r89400539"},"pull_request":{"href":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12","id":95077208,"html_url":"https://github.com/admdwrf/ovhcli/pull/12","diff_url":"https://github.com/admdwrf/ovhcli/pull/12.diff","patch_url":"https://github.com/admdwrf/ovhcli/pull/12.patch","issue_url":"https://api.github.com/repos/admdwrf/ovhcli/issues/12","number":12,"state":"open","locked":false,"title":"use goroutine to parallelize domainInfo request","user":{"login":"MarcAudefroy","id":2056363,"avatar_url":"https://avatars.githubusercontent.com/u/2056363?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcAudefroy","html_url":"https://github.com/MarcAudefroy","followers_url":"https://api.github.com/users/MarcAudefroy/followers","following_url":"https://api.github.com/users/MarcAudefroy/following{/other_user}","gists_url":"https://api.github.com/users/MarcAudefroy/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcAudefroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcAudefroy/subscriptions","organizations_url":"https://api.github.com/users/MarcAudefroy/orgs","repos_url":"https://api.github.com/users/MarcAudefroy/repos","events_url":"https://api.github.com/users/MarcAudefroy/events{/privacy}","received_events_url":"https://api.github.com/users/MarcAudefroy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-23T20:48:42Z","updated_at":"2016-11-23T21:18:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5494b04e2d0275d805c4090312483d48b09ba1ad","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12/commits","review_comments_url":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12/comments","review_comment_url":"https://api.github.com/repos/admdwrf/ovhcli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/admdwrf/ovhcli/issues/12/comments","statuses_url":"https://api.github.com/repos/admdwrf/ovhcli/statuses/fff14e390ec3dfe6c982840fa2015813d0ed0e11","head":{"label":"MarcAudefroy:domain_list_goroutine","ref":"domain_list_goroutine","sha":"fff14e390ec3dfe6c982840fa2015813d0ed0e11","user":{"login":"MarcAudefroy","id":2056363,"avatar_url":"https://avatars.githubusercontent.com/u/2056363?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcAudefroy","html_url":"https://github.com/MarcAudefroy","followers_url":"https://api.github.com/users/MarcAudefroy/followers","following_url":"https://api.github.com/users/MarcAudefroy/following{/other_user}","gists_url":"https://api.github.com/users/MarcAudefroy/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcAudefroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcAudefroy/subscriptions","organizations_url":"https://api.github.com/users/MarcAudefroy/orgs","repos_url":"https://api.github.com/users/MarcAudefroy/repos","events_url":"https://api.github.com/users/MarcAudefroy/events{/privacy}","received_events_url":"https://api.github.com/users/MarcAudefroy/received_events","type":"User","site_admin":false},"repo":{"id":74409532,"name":"ovhcli","full_name":"MarcAudefroy/ovhcli","owner":{"login":"MarcAudefroy","id":2056363,"avatar_url":"https://avatars.githubusercontent.com/u/2056363?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcAudefroy","html_url":"https://github.com/MarcAudefroy","followers_url":"https://api.github.com/users/MarcAudefroy/followers","following_url":"https://api.github.com/users/MarcAudefroy/following{/other_user}","gists_url":"https://api.github.com/users/MarcAudefroy/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcAudefroy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcAudefroy/subscriptions","organizations_url":"https://api.github.com/users/MarcAudefroy/orgs","repos_url":"https://api.github.com/users/MarcAudefroy/repos","events_url":"https://api.github.com/users/MarcAudefroy/events{/privacy}","received_events_url":"https://api.github.com/users/MarcAudefroy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MarcAudefroy/ovhcli","description":null,"fork":true,"url":"https://api.github.com/repos/MarcAudefroy/ovhcli","forks_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/forks","keys_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/teams","hooks_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/hooks","issue_events_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/issues/events{/number}","events_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/events","assignees_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/assignees{/user}","branches_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/branches{/branch}","tags_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/tags","blobs_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/git/refs{/sha}","trees_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/statuses/{sha}","languages_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/languages","stargazers_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/stargazers","contributors_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/contributors","subscribers_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/subscribers","subscription_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/subscription","commits_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/commits{/sha}","git_commits_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/git/commits{/sha}","comments_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/comments{/number}","issue_comment_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/issues/comments{/number}","contents_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/contents/{+path}","compare_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/merges","archive_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/downloads","issues_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/issues{/number}","pulls_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/pulls{/number}","milestones_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/milestones{/number}","notifications_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/labels{/name}","releases_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/releases{/id}","deployments_url":"https://api.github.com/repos/MarcAudefroy/ovhcli/deployments","created_at":"2016-11-21T21:57:51Z","updated_at":"2016-11-21T21:57:52Z","pushed_at":"2016-11-23T21:17:26Z","git_url":"git://github.com/MarcAudefroy/ovhcli.git","ssh_url":"git@github.com:MarcAudefroy/ovhcli.git","clone_url":"https://github.com/MarcAudefroy/ovhcli.git","svn_url":"https://github.com/MarcAudefroy/ovhcli","homepage":null,"size":239,"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":"admdwrf:master","ref":"master","sha":"c8219a1ec52222f95fd2c5dd0d7485382c62baa4","user":{"login":"admdwrf","id":9548962,"avatar_url":"https://avatars.githubusercontent.com/u/9548962?v=3","gravatar_id":"","url":"https://api.github.com/users/admdwrf","html_url":"https://github.com/admdwrf","followers_url":"https://api.github.com/users/admdwrf/followers","following_url":"https://api.github.com/users/admdwrf/following{/other_user}","gists_url":"https://api.github.com/users/admdwrf/gists{/gist_id}","starred_url":"https://api.github.com/users/admdwrf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/admdwrf/subscriptions","organizations_url":"https://api.github.com/users/admdwrf/orgs","repos_url":"https://api.github.com/users/admdwrf/repos","events_url":"https://api.github.com/users/admdwrf/events{/privacy}","received_events_url":"https://api.github.com/users/admdwrf/received_events","type":"User","site_admin":false},"repo":{"id":74140608,"name":"ovhcli","full_name":"admdwrf/ovhcli","owner":{"login":"admdwrf","id":9548962,"avatar_url":"https://avatars.githubusercontent.com/u/9548962?v=3","gravatar_id":"","url":"https://api.github.com/users/admdwrf","html_url":"https://github.com/admdwrf","followers_url":"https://api.github.com/users/admdwrf/followers","following_url":"https://api.github.com/users/admdwrf/following{/other_user}","gists_url":"https://api.github.com/users/admdwrf/gists{/gist_id}","starred_url":"https://api.github.com/users/admdwrf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/admdwrf/subscriptions","organizations_url":"https://api.github.com/users/admdwrf/orgs","repos_url":"https://api.github.com/users/admdwrf/repos","events_url":"https://api.github.com/users/admdwrf/events{/privacy}","received_events_url":"https://api.github.com/users/admdwrf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/admdwrf/ovhcli","description":null,"fork":false,"url":"https://api.github.com/repos/admdwrf/ovhcli","forks_url":"https://api.github.com/repos/admdwrf/ovhcli/forks","keys_url":"https://api.github.com/repos/admdwrf/ovhcli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/admdwrf/ovhcli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/admdwrf/ovhcli/teams","hooks_url":"https://api.github.com/repos/admdwrf/ovhcli/hooks","issue_events_url":"https://api.github.com/repos/admdwrf/ovhcli/issues/events{/number}","events_url":"https://api.github.com/repos/admdwrf/ovhcli/events","assignees_url":"https://api.github.com/repos/admdwrf/ovhcli/assignees{/user}","branches_url":"https://api.github.com/repos/admdwrf/ovhcli/branches{/branch}","tags_url":"https://api.github.com/repos/admdwrf/ovhcli/tags","blobs_url":"https://api.github.com/repos/admdwrf/ovhcli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/admdwrf/ovhcli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/admdwrf/ovhcli/git/refs{/sha}","trees_url":"https://api.github.com/repos/admdwrf/ovhcli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/admdwrf/ovhcli/statuses/{sha}","languages_url":"https://api.github.com/repos/admdwrf/ovhcli/languages","stargazers_url":"https://api.github.com/repos/admdwrf/ovhcli/stargazers","contributors_url":"https://api.github.com/repos/admdwrf/ovhcli/contributors","subscribers_url":"https://api.github.com/repos/admdwrf/ovhcli/subscribers","subscription_url":"https://api.github.com/repos/admdwrf/ovhcli/subscription","commits_url":"https://api.github.com/repos/admdwrf/ovhcli/commits{/sha}","git_commits_url":"https://api.github.com/repos/admdwrf/ovhcli/git/commits{/sha}","comments_url":"https://api.github.com/repos/admdwrf/ovhcli/comments{/number}","issue_comment_url":"https://api.github.com/repos/admdwrf/ovhcli/issues/comments{/number}","contents_url":"https://api.github.com/repos/admdwrf/ovhcli/contents/{+path}","compare_url":"https://api.github.com/repos/admdwrf/ovhcli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/admdwrf/ovhcli/merges","archive_url":"https://api.github.com/repos/admdwrf/ovhcli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/admdwrf/ovhcli/downloads","issues_url":"https://api.github.com/repos/admdwrf/ovhcli/issues{/number}","pulls_url":"https://api.github.com/repos/admdwrf/ovhcli/pulls{/number}","milestones_url":"https://api.github.com/repos/admdwrf/ovhcli/milestones{/number}","notifications_url":"https://api.github.com/repos/admdwrf/ovhcli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/admdwrf/ovhcli/labels{/name}","releases_url":"https://api.github.com/repos/admdwrf/ovhcli/releases{/id}","deployments_url":"https://api.github.com/repos/admdwrf/ovhcli/deployments","created_at":"2016-11-18T15:14:59Z","updated_at":"2016-11-18T15:15:51Z","pushed_at":"2016-11-23T21:17:26Z","git_url":"git://github.com/admdwrf/ovhcli.git","ssh_url":"git@github.com:admdwrf/ovhcli.git","clone_url":"https://github.com/admdwrf/ovhcli.git","svn_url":"https://github.com/admdwrf/ovhcli","homepage":null,"size":298,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12"},"html":{"href":"https://github.com/admdwrf/ovhcli/pull/12"},"issue":{"href":"https://api.github.com/repos/admdwrf/ovhcli/issues/12"},"comments":{"href":"https://api.github.com/repos/admdwrf/ovhcli/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/admdwrf/ovhcli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/admdwrf/ovhcli/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/admdwrf/ovhcli/statuses/fff14e390ec3dfe6c982840fa2015813d0ed0e11"}}}}
{"actor":{"display_login":"fsamin"}}