{"action":"created","comment":{"url":"https://api.github.com/repos/golang/mock/pulls/comments/64487873","id":64487873,"diff_hunk":"@@ -75,6 +75,9 @@ func (c *Call) Do(f interface{}) *Call {\n \treturn c\n }\n \n+// Return sets the values to return when the target method is called.\n+//\n+// If Return and Do are called, the values returned via Do will be returned.","path":"gomock/call.go","position":6,"original_position":6,"commit_id":"6a0de6ff39b0b3e717a289ce517ca0f2c79d5ce8","original_commit_id":"6a0de6ff39b0b3e717a289ce517ca0f2c79d5ce8","user":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"body":"@kaedys Thanks for the analysis. This PR is really an attempt to open the conversation about using this package as a tool to create stub functions.\r\n\r\nThe main problem here is that after using this mock library for simple cases, one may have to switch over to stubs if it is required to respond to input.\r\n\r\nIt is also slightly obnoxious that it is not clear that `Do` cannot return a value and it took time to identify this as the problem. A panic for mismatched function signature would be a gift, as it would have exposed the error in my code. Either that, or we have some compile time type-safety to give us the correct stub types.\r\n\r\n> On a behavioral side, an explicit call to Return should probably override the return-what-Do-returned behavior (if you're explicitly calling Return, it's because you want the function to return something specific), and the code in general should probably be updated to only return the Dofunc return values if they match the number and type of the parent function itself.\r\n\r\nI considered this. Either behavior is problematic, as it may result in test failures for existing uses, making the change backwards compatible.\r\n\r\nPerhaps, we should define a new method, `Stub` for this functionality.","created_at":"2016-05-24T22:40:49Z","updated_at":"2016-05-24T22:40:49Z","html_url":"https://github.com/golang/mock/pull/35#discussion_r64487873","pull_request_url":"https://api.github.com/repos/golang/mock/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/golang/mock/pulls/comments/64487873"},"html":{"href":"https://github.com/golang/mock/pull/35#discussion_r64487873"},"pull_request":{"href":"https://api.github.com/repos/golang/mock/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/golang/mock/pulls/35","id":70468725,"html_url":"https://github.com/golang/mock/pull/35","diff_url":"https://github.com/golang/mock/pull/35.diff","patch_url":"https://github.com/golang/mock/pull/35.patch","issue_url":"https://api.github.com/repos/golang/mock/issues/35","number":35,"state":"open","locked":false,"title":"mock: methods should return values from Do","user":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"body":"Updates (*Call).call to return the values from returned from Do\r\nfunctions. Makes this package useful for stubbing, in addition to\r\nmocking.\r\n\r\nSigned-off-by: Stephen J Day <stephen.day@docker.com>\r\n\r\nCloses #34.\r\n\r\nMay require more testing.","created_at":"2016-05-18T04:49:29Z","updated_at":"2016-05-24T22:40:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56a58604966ea38e452312bcc28f1320682061b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/golang/mock/pulls/35/commits","review_comments_url":"https://api.github.com/repos/golang/mock/pulls/35/comments","review_comment_url":"https://api.github.com/repos/golang/mock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/golang/mock/issues/35/comments","statuses_url":"https://api.github.com/repos/golang/mock/statuses/6a0de6ff39b0b3e717a289ce517ca0f2c79d5ce8","head":{"label":"stevvooe:functions-return-their-values","ref":"functions-return-their-values","sha":"6a0de6ff39b0b3e717a289ce517ca0f2c79d5ce8","user":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"repo":{"id":59082781,"name":"mock","full_name":"stevvooe/mock","owner":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stevvooe/mock","description":"GoMock is a mocking framework for the Go programming language.","fork":true,"url":"https://api.github.com/repos/stevvooe/mock","forks_url":"https://api.github.com/repos/stevvooe/mock/forks","keys_url":"https://api.github.com/repos/stevvooe/mock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stevvooe/mock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stevvooe/mock/teams","hooks_url":"https://api.github.com/repos/stevvooe/mock/hooks","issue_events_url":"https://api.github.com/repos/stevvooe/mock/issues/events{/number}","events_url":"https://api.github.com/repos/stevvooe/mock/events","assignees_url":"https://api.github.com/repos/stevvooe/mock/assignees{/user}","branches_url":"https://api.github.com/repos/stevvooe/mock/branches{/branch}","tags_url":"https://api.github.com/repos/stevvooe/mock/tags","blobs_url":"https://api.github.com/repos/stevvooe/mock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stevvooe/mock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stevvooe/mock/git/refs{/sha}","trees_url":"https://api.github.com/repos/stevvooe/mock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stevvooe/mock/statuses/{sha}","languages_url":"https://api.github.com/repos/stevvooe/mock/languages","stargazers_url":"https://api.github.com/repos/stevvooe/mock/stargazers","contributors_url":"https://api.github.com/repos/stevvooe/mock/contributors","subscribers_url":"https://api.github.com/repos/stevvooe/mock/subscribers","subscription_url":"https://api.github.com/repos/stevvooe/mock/subscription","commits_url":"https://api.github.com/repos/stevvooe/mock/commits{/sha}","git_commits_url":"https://api.github.com/repos/stevvooe/mock/git/commits{/sha}","comments_url":"https://api.github.com/repos/stevvooe/mock/comments{/number}","issue_comment_url":"https://api.github.com/repos/stevvooe/mock/issues/comments{/number}","contents_url":"https://api.github.com/repos/stevvooe/mock/contents/{+path}","compare_url":"https://api.github.com/repos/stevvooe/mock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stevvooe/mock/merges","archive_url":"https://api.github.com/repos/stevvooe/mock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stevvooe/mock/downloads","issues_url":"https://api.github.com/repos/stevvooe/mock/issues{/number}","pulls_url":"https://api.github.com/repos/stevvooe/mock/pulls{/number}","milestones_url":"https://api.github.com/repos/stevvooe/mock/milestones{/number}","notifications_url":"https://api.github.com/repos/stevvooe/mock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stevvooe/mock/labels{/name}","releases_url":"https://api.github.com/repos/stevvooe/mock/releases{/id}","deployments_url":"https://api.github.com/repos/stevvooe/mock/deployments","created_at":"2016-05-18T04:47:52Z","updated_at":"2016-05-18T04:47:53Z","pushed_at":"2016-05-18T04:48:42Z","git_url":"git://github.com/stevvooe/mock.git","ssh_url":"git@github.com:stevvooe/mock.git","clone_url":"https://github.com/stevvooe/mock.git","svn_url":"https://github.com/stevvooe/mock","homepage":null,"size":122,"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":"golang:master","ref":"master","sha":"bd3c8e81be01eef76d4b503f5e687d2d1354d2d9","user":{"login":"golang","id":4314092,"avatar_url":"https://avatars.githubusercontent.com/u/4314092?v=3","gravatar_id":"","url":"https://api.github.com/users/golang","html_url":"https://github.com/golang","followers_url":"https://api.github.com/users/golang/followers","following_url":"https://api.github.com/users/golang/following{/other_user}","gists_url":"https://api.github.com/users/golang/gists{/gist_id}","starred_url":"https://api.github.com/users/golang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golang/subscriptions","organizations_url":"https://api.github.com/users/golang/orgs","repos_url":"https://api.github.com/users/golang/repos","events_url":"https://api.github.com/users/golang/events{/privacy}","received_events_url":"https://api.github.com/users/golang/received_events","type":"Organization","site_admin":false},"repo":{"id":37334619,"name":"mock","full_name":"golang/mock","owner":{"login":"golang","id":4314092,"avatar_url":"https://avatars.githubusercontent.com/u/4314092?v=3","gravatar_id":"","url":"https://api.github.com/users/golang","html_url":"https://github.com/golang","followers_url":"https://api.github.com/users/golang/followers","following_url":"https://api.github.com/users/golang/following{/other_user}","gists_url":"https://api.github.com/users/golang/gists{/gist_id}","starred_url":"https://api.github.com/users/golang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golang/subscriptions","organizations_url":"https://api.github.com/users/golang/orgs","repos_url":"https://api.github.com/users/golang/repos","events_url":"https://api.github.com/users/golang/events{/privacy}","received_events_url":"https://api.github.com/users/golang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/golang/mock","description":"GoMock is a mocking framework for the Go programming language.","fork":false,"url":"https://api.github.com/repos/golang/mock","forks_url":"https://api.github.com/repos/golang/mock/forks","keys_url":"https://api.github.com/repos/golang/mock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/golang/mock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/golang/mock/teams","hooks_url":"https://api.github.com/repos/golang/mock/hooks","issue_events_url":"https://api.github.com/repos/golang/mock/issues/events{/number}","events_url":"https://api.github.com/repos/golang/mock/events","assignees_url":"https://api.github.com/repos/golang/mock/assignees{/user}","branches_url":"https://api.github.com/repos/golang/mock/branches{/branch}","tags_url":"https://api.github.com/repos/golang/mock/tags","blobs_url":"https://api.github.com/repos/golang/mock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/golang/mock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/golang/mock/git/refs{/sha}","trees_url":"https://api.github.com/repos/golang/mock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/golang/mock/statuses/{sha}","languages_url":"https://api.github.com/repos/golang/mock/languages","stargazers_url":"https://api.github.com/repos/golang/mock/stargazers","contributors_url":"https://api.github.com/repos/golang/mock/contributors","subscribers_url":"https://api.github.com/repos/golang/mock/subscribers","subscription_url":"https://api.github.com/repos/golang/mock/subscription","commits_url":"https://api.github.com/repos/golang/mock/commits{/sha}","git_commits_url":"https://api.github.com/repos/golang/mock/git/commits{/sha}","comments_url":"https://api.github.com/repos/golang/mock/comments{/number}","issue_comment_url":"https://api.github.com/repos/golang/mock/issues/comments{/number}","contents_url":"https://api.github.com/repos/golang/mock/contents/{+path}","compare_url":"https://api.github.com/repos/golang/mock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/golang/mock/merges","archive_url":"https://api.github.com/repos/golang/mock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/golang/mock/downloads","issues_url":"https://api.github.com/repos/golang/mock/issues{/number}","pulls_url":"https://api.github.com/repos/golang/mock/pulls{/number}","milestones_url":"https://api.github.com/repos/golang/mock/milestones{/number}","notifications_url":"https://api.github.com/repos/golang/mock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/golang/mock/labels{/name}","releases_url":"https://api.github.com/repos/golang/mock/releases{/id}","deployments_url":"https://api.github.com/repos/golang/mock/deployments","created_at":"2015-06-12T17:15:11Z","updated_at":"2016-05-24T09:38:34Z","pushed_at":"2016-05-18T04:49:29Z","git_url":"git://github.com/golang/mock.git","ssh_url":"git@github.com:golang/mock.git","clone_url":"https://github.com/golang/mock.git","svn_url":"https://github.com/golang/mock","homepage":null,"size":174,"stargazers_count":263,"watchers_count":263,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":11,"forks":37,"open_issues":11,"watchers":263,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/golang/mock/pulls/35"},"html":{"href":"https://github.com/golang/mock/pull/35"},"issue":{"href":"https://api.github.com/repos/golang/mock/issues/35"},"comments":{"href":"https://api.github.com/repos/golang/mock/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/golang/mock/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/golang/mock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/golang/mock/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/golang/mock/statuses/6a0de6ff39b0b3e717a289ce517ca0f2c79d5ce8"}}}}
{"actor":{"display_login":"stevvooe"}}