{"action":"created","comment":{"url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/comments/92523736","pull_request_review_id":13040807,"id":92523736,"diff_hunk":"@@ -546,17 +546,46 @@ func (q Query) ToMapByT(result interface{}, keySelectorFn interface{}, valueSele\n \tq.ToMapBy(result, keySelectorFunc, valueSelectorFunc)\n }\n \n-// ToSlice iterates over a collection and populates the result slice with elements.\n-// Collection elements must be assignable to the slice's element type.\n-// ToSlice doesn't empty the result slice before populating it.\n-func (q Query) ToSlice(result interface{}) {\n-\tres := reflect.ValueOf(result)\n+// ToSlice iterates over a collection and saves the results in the slice pointed\n+// by v. It starts saving elements starting from index 0, therefore it will\n+// overwrite the slice.\n+//\n+// If the slice pointed by v has sufficient capacity, v will be pointed to a\n+// resliced slice. If it does not, a new underlying array will be allocated and\n+// v will point to it.\n+func (q Query) ToSlice(v interface{}) {\n+\tres := reflect.ValueOf(v)\n \tslice := reflect.Indirect(res)\n \tnext := q.Iterate()\n-\n+\tindex := 0\n \tfor item, ok := next(); ok; item, ok = next() {\n-\t\tslice = reflect.Append(slice, reflect.ValueOf(item))\n+\t\tif index >= slice.Len() {\n+\t\t\tslice = grow(slice, 1)","path":"result.go","position":25,"original_position":25,"commit_id":"702310f6456e36c504023b4abfd97235153ceca7","original_commit_id":"702310f6456e36c504023b4abfd97235153ceca7","user":{"login":"ahmetalpbalkan","id":159209,"avatar_url":"https://avatars.githubusercontent.com/u/159209?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmetalpbalkan","html_url":"https://github.com/ahmetalpbalkan","followers_url":"https://api.github.com/users/ahmetalpbalkan/followers","following_url":"https://api.github.com/users/ahmetalpbalkan/following{/other_user}","gists_url":"https://api.github.com/users/ahmetalpbalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmetalpbalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmetalpbalkan/subscriptions","organizations_url":"https://api.github.com/users/ahmetalpbalkan/orgs","repos_url":"https://api.github.com/users/ahmetalpbalkan/repos","events_url":"https://api.github.com/users/ahmetalpbalkan/events{/privacy}","received_events_url":"https://api.github.com/users/ahmetalpbalkan/received_events","type":"User","site_admin":false},"body":"Actually, we can do this in another follow-up PR. Let me know if you want to keep working on the current PR to implement the proposed algorithm, or if you want this to just get merged and you can open a PR later.","created_at":"2016-12-15T00:48:55Z","updated_at":"2016-12-15T00:48:55Z","html_url":"https://github.com/ahmetalpbalkan/go-linq/pull/46#discussion_r92523736","pull_request_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/comments/92523736"},"html":{"href":"https://github.com/ahmetalpbalkan/go-linq/pull/46#discussion_r92523736"},"pull_request":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46","id":96471598,"html_url":"https://github.com/ahmetalpbalkan/go-linq/pull/46","diff_url":"https://github.com/ahmetalpbalkan/go-linq/pull/46.diff","patch_url":"https://github.com/ahmetalpbalkan/go-linq/pull/46.patch","issue_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues/46","number":46,"state":"open","locked":false,"title":"AppendToSlice - Issue #43","user":{"login":"cleitonmarx","id":2603144,"avatar_url":"https://avatars.githubusercontent.com/u/2603144?v=3","gravatar_id":"","url":"https://api.github.com/users/cleitonmarx","html_url":"https://github.com/cleitonmarx","followers_url":"https://api.github.com/users/cleitonmarx/followers","following_url":"https://api.github.com/users/cleitonmarx/following{/other_user}","gists_url":"https://api.github.com/users/cleitonmarx/gists{/gist_id}","starred_url":"https://api.github.com/users/cleitonmarx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cleitonmarx/subscriptions","organizations_url":"https://api.github.com/users/cleitonmarx/orgs","repos_url":"https://api.github.com/users/cleitonmarx/repos","events_url":"https://api.github.com/users/cleitonmarx/events{/privacy}","received_events_url":"https://api.github.com/users/cleitonmarx/received_events","type":"User","site_admin":false},"body":"Closes #43","created_at":"2016-12-05T05:33:52Z","updated_at":"2016-12-15T00:48:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76821b41cdb21a832c5c05be4e0ce9be374c9e55","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46/commits","review_comments_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46/comments","review_comment_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues/46/comments","statuses_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/statuses/702310f6456e36c504023b4abfd97235153ceca7","head":{"label":"cleitonmarx:AppendToSlice","ref":"AppendToSlice","sha":"702310f6456e36c504023b4abfd97235153ceca7","user":{"login":"cleitonmarx","id":2603144,"avatar_url":"https://avatars.githubusercontent.com/u/2603144?v=3","gravatar_id":"","url":"https://api.github.com/users/cleitonmarx","html_url":"https://github.com/cleitonmarx","followers_url":"https://api.github.com/users/cleitonmarx/followers","following_url":"https://api.github.com/users/cleitonmarx/following{/other_user}","gists_url":"https://api.github.com/users/cleitonmarx/gists{/gist_id}","starred_url":"https://api.github.com/users/cleitonmarx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cleitonmarx/subscriptions","organizations_url":"https://api.github.com/users/cleitonmarx/orgs","repos_url":"https://api.github.com/users/cleitonmarx/repos","events_url":"https://api.github.com/users/cleitonmarx/events{/privacy}","received_events_url":"https://api.github.com/users/cleitonmarx/received_events","type":"User","site_admin":false},"repo":{"id":58611132,"name":"go-linq","full_name":"cleitonmarx/go-linq","owner":{"login":"cleitonmarx","id":2603144,"avatar_url":"https://avatars.githubusercontent.com/u/2603144?v=3","gravatar_id":"","url":"https://api.github.com/users/cleitonmarx","html_url":"https://github.com/cleitonmarx","followers_url":"https://api.github.com/users/cleitonmarx/followers","following_url":"https://api.github.com/users/cleitonmarx/following{/other_user}","gists_url":"https://api.github.com/users/cleitonmarx/gists{/gist_id}","starred_url":"https://api.github.com/users/cleitonmarx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cleitonmarx/subscriptions","organizations_url":"https://api.github.com/users/cleitonmarx/orgs","repos_url":"https://api.github.com/users/cleitonmarx/repos","events_url":"https://api.github.com/users/cleitonmarx/events{/privacy}","received_events_url":"https://api.github.com/users/cleitonmarx/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cleitonmarx/go-linq","description":".NET LINQ-like query methods for Go","fork":true,"url":"https://api.github.com/repos/cleitonmarx/go-linq","forks_url":"https://api.github.com/repos/cleitonmarx/go-linq/forks","keys_url":"https://api.github.com/repos/cleitonmarx/go-linq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cleitonmarx/go-linq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cleitonmarx/go-linq/teams","hooks_url":"https://api.github.com/repos/cleitonmarx/go-linq/hooks","issue_events_url":"https://api.github.com/repos/cleitonmarx/go-linq/issues/events{/number}","events_url":"https://api.github.com/repos/cleitonmarx/go-linq/events","assignees_url":"https://api.github.com/repos/cleitonmarx/go-linq/assignees{/user}","branches_url":"https://api.github.com/repos/cleitonmarx/go-linq/branches{/branch}","tags_url":"https://api.github.com/repos/cleitonmarx/go-linq/tags","blobs_url":"https://api.github.com/repos/cleitonmarx/go-linq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cleitonmarx/go-linq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cleitonmarx/go-linq/git/refs{/sha}","trees_url":"https://api.github.com/repos/cleitonmarx/go-linq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cleitonmarx/go-linq/statuses/{sha}","languages_url":"https://api.github.com/repos/cleitonmarx/go-linq/languages","stargazers_url":"https://api.github.com/repos/cleitonmarx/go-linq/stargazers","contributors_url":"https://api.github.com/repos/cleitonmarx/go-linq/contributors","subscribers_url":"https://api.github.com/repos/cleitonmarx/go-linq/subscribers","subscription_url":"https://api.github.com/repos/cleitonmarx/go-linq/subscription","commits_url":"https://api.github.com/repos/cleitonmarx/go-linq/commits{/sha}","git_commits_url":"https://api.github.com/repos/cleitonmarx/go-linq/git/commits{/sha}","comments_url":"https://api.github.com/repos/cleitonmarx/go-linq/comments{/number}","issue_comment_url":"https://api.github.com/repos/cleitonmarx/go-linq/issues/comments{/number}","contents_url":"https://api.github.com/repos/cleitonmarx/go-linq/contents/{+path}","compare_url":"https://api.github.com/repos/cleitonmarx/go-linq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cleitonmarx/go-linq/merges","archive_url":"https://api.github.com/repos/cleitonmarx/go-linq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cleitonmarx/go-linq/downloads","issues_url":"https://api.github.com/repos/cleitonmarx/go-linq/issues{/number}","pulls_url":"https://api.github.com/repos/cleitonmarx/go-linq/pulls{/number}","milestones_url":"https://api.github.com/repos/cleitonmarx/go-linq/milestones{/number}","notifications_url":"https://api.github.com/repos/cleitonmarx/go-linq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cleitonmarx/go-linq/labels{/name}","releases_url":"https://api.github.com/repos/cleitonmarx/go-linq/releases{/id}","deployments_url":"https://api.github.com/repos/cleitonmarx/go-linq/deployments","created_at":"2016-05-12T05:40:37Z","updated_at":"2016-10-25T16:37:26Z","pushed_at":"2016-12-15T00:20:17Z","git_url":"git://github.com/cleitonmarx/go-linq.git","ssh_url":"git@github.com:cleitonmarx/go-linq.git","clone_url":"https://github.com/cleitonmarx/go-linq.git","svn_url":"https://github.com/cleitonmarx/go-linq","homepage":"http://ahmetalpbalkan.github.io/go-linq","size":862,"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":"ahmetalpbalkan:v3-dev","ref":"v3-dev","sha":"fdda798fb99258e073d46176d34c9a6d60ec04aa","user":{"login":"ahmetalpbalkan","id":159209,"avatar_url":"https://avatars.githubusercontent.com/u/159209?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmetalpbalkan","html_url":"https://github.com/ahmetalpbalkan","followers_url":"https://api.github.com/users/ahmetalpbalkan/followers","following_url":"https://api.github.com/users/ahmetalpbalkan/following{/other_user}","gists_url":"https://api.github.com/users/ahmetalpbalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmetalpbalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmetalpbalkan/subscriptions","organizations_url":"https://api.github.com/users/ahmetalpbalkan/orgs","repos_url":"https://api.github.com/users/ahmetalpbalkan/repos","events_url":"https://api.github.com/users/ahmetalpbalkan/events{/privacy}","received_events_url":"https://api.github.com/users/ahmetalpbalkan/received_events","type":"User","site_admin":false},"repo":{"id":15300997,"name":"go-linq","full_name":"ahmetalpbalkan/go-linq","owner":{"login":"ahmetalpbalkan","id":159209,"avatar_url":"https://avatars.githubusercontent.com/u/159209?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmetalpbalkan","html_url":"https://github.com/ahmetalpbalkan","followers_url":"https://api.github.com/users/ahmetalpbalkan/followers","following_url":"https://api.github.com/users/ahmetalpbalkan/following{/other_user}","gists_url":"https://api.github.com/users/ahmetalpbalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmetalpbalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmetalpbalkan/subscriptions","organizations_url":"https://api.github.com/users/ahmetalpbalkan/orgs","repos_url":"https://api.github.com/users/ahmetalpbalkan/repos","events_url":"https://api.github.com/users/ahmetalpbalkan/events{/privacy}","received_events_url":"https://api.github.com/users/ahmetalpbalkan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ahmetalpbalkan/go-linq","description":".NET LINQ-like query methods for Go","fork":false,"url":"https://api.github.com/repos/ahmetalpbalkan/go-linq","forks_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/forks","keys_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/teams","hooks_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/hooks","issue_events_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues/events{/number}","events_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/events","assignees_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/assignees{/user}","branches_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/branches{/branch}","tags_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/tags","blobs_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/statuses/{sha}","languages_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/languages","stargazers_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/stargazers","contributors_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/contributors","subscribers_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/subscribers","subscription_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/subscription","commits_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/contents/{+path}","compare_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/merges","archive_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/downloads","issues_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues{/number}","pulls_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls{/number}","milestones_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/milestones{/number}","notifications_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/labels{/name}","releases_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/releases{/id}","deployments_url":"https://api.github.com/repos/ahmetalpbalkan/go-linq/deployments","created_at":"2013-12-19T03:05:00Z","updated_at":"2016-12-09T20:32:12Z","pushed_at":"2016-12-15T00:20:17Z","git_url":"git://github.com/ahmetalpbalkan/go-linq.git","ssh_url":"git@github.com:ahmetalpbalkan/go-linq.git","clone_url":"https://github.com/ahmetalpbalkan/go-linq.git","svn_url":"https://github.com/ahmetalpbalkan/go-linq","homepage":"http://ahmetalpbalkan.github.io/go-linq","size":828,"stargazers_count":897,"watchers_count":897,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":60,"mirror_url":null,"open_issues_count":3,"forks":60,"open_issues":3,"watchers":897,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46"},"html":{"href":"https://github.com/ahmetalpbalkan/go-linq/pull/46"},"issue":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues/46"},"comments":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/ahmetalpbalkan/go-linq/statuses/702310f6456e36c504023b4abfd97235153ceca7"}}}}
{"actor":{"display_login":"ahmetalpbalkan"}}