{"action":"closed","number":59,"pull_request":{"url":"https://api.github.com/repos/kisielk/errcheck/pulls/59","id":27951871,"html_url":"https://github.com/kisielk/errcheck/pull/59","diff_url":"https://github.com/kisielk/errcheck/pull/59.diff","patch_url":"https://github.com/kisielk/errcheck/pull/59.patch","issue_url":"https://api.github.com/repos/kisielk/errcheck/issues/59","number":59,"state":"closed","locked":false,"title":"Make main testable","user":{"login":"zimmski","id":1847950,"avatar_url":"https://avatars.githubusercontent.com/u/1847950?v=3","gravatar_id":"","url":"https://api.github.com/users/zimmski","html_url":"https://github.com/zimmski","followers_url":"https://api.github.com/users/zimmski/followers","following_url":"https://api.github.com/users/zimmski/following{/other_user}","gists_url":"https://api.github.com/users/zimmski/gists{/gist_id}","starred_url":"https://api.github.com/users/zimmski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zimmski/subscriptions","organizations_url":"https://api.github.com/users/zimmski/orgs","repos_url":"https://api.github.com/users/zimmski/repos","events_url":"https://api.github.com/users/zimmski/events{/privacy}","received_events_url":"https://api.github.com/users/zimmski/received_events","type":"User","site_admin":false},"body":"The main of errcheck is untested which is never a good think. I made it testable by putting the whole main into its own function which can be called with arguments. I find this approach much better than what the Go guys are doing with most cmds e.g. https://github.com/golang/tools/blob/master/cmd/vet/vet_test.go that is building the binary during the test and then executing it as an external command. I hope you agree.\r\n\r\nThis PR does not test every feature of the main. It is basically just a smoke test. But we could put it in a function and then test every scenario if you like. However, to be honest,  I am personally not that interested in doing that myself :whale: ","created_at":"2015-01-23T20:15:43Z","updated_at":"2015-01-23T22:24:53Z","closed_at":"2015-01-23T22:24:53Z","merged_at":"2015-01-23T22:24:53Z","merge_commit_sha":"eb1beac749366a1075b8a4a96ff420cd5cb3faf8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kisielk/errcheck/pulls/59/commits","review_comments_url":"https://api.github.com/repos/kisielk/errcheck/pulls/59/comments","review_comment_url":"https://api.github.com/repos/kisielk/errcheck/pulls/comments/{number}","comments_url":"https://api.github.com/repos/kisielk/errcheck/issues/59/comments","statuses_url":"https://api.github.com/repos/kisielk/errcheck/statuses/3ba72342416f6b597511209a8be95097c8deae5a","head":{"label":"zimmski:make-main-testable","ref":"make-main-testable","sha":"3ba72342416f6b597511209a8be95097c8deae5a","user":{"login":"zimmski","id":1847950,"avatar_url":"https://avatars.githubusercontent.com/u/1847950?v=3","gravatar_id":"","url":"https://api.github.com/users/zimmski","html_url":"https://github.com/zimmski","followers_url":"https://api.github.com/users/zimmski/followers","following_url":"https://api.github.com/users/zimmski/following{/other_user}","gists_url":"https://api.github.com/users/zimmski/gists{/gist_id}","starred_url":"https://api.github.com/users/zimmski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zimmski/subscriptions","organizations_url":"https://api.github.com/users/zimmski/orgs","repos_url":"https://api.github.com/users/zimmski/repos","events_url":"https://api.github.com/users/zimmski/events{/privacy}","received_events_url":"https://api.github.com/users/zimmski/received_events","type":"User","site_admin":false},"repo":{"id":24722939,"name":"errcheck","full_name":"zimmski/errcheck","owner":{"login":"zimmski","id":1847950,"avatar_url":"https://avatars.githubusercontent.com/u/1847950?v=3","gravatar_id":"","url":"https://api.github.com/users/zimmski","html_url":"https://github.com/zimmski","followers_url":"https://api.github.com/users/zimmski/followers","following_url":"https://api.github.com/users/zimmski/following{/other_user}","gists_url":"https://api.github.com/users/zimmski/gists{/gist_id}","starred_url":"https://api.github.com/users/zimmski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zimmski/subscriptions","organizations_url":"https://api.github.com/users/zimmski/orgs","repos_url":"https://api.github.com/users/zimmski/repos","events_url":"https://api.github.com/users/zimmski/events{/privacy}","received_events_url":"https://api.github.com/users/zimmski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zimmski/errcheck","description":"errcheck checks that you checked errors.","fork":true,"url":"https://api.github.com/repos/zimmski/errcheck","forks_url":"https://api.github.com/repos/zimmski/errcheck/forks","keys_url":"https://api.github.com/repos/zimmski/errcheck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zimmski/errcheck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zimmski/errcheck/teams","hooks_url":"https://api.github.com/repos/zimmski/errcheck/hooks","issue_events_url":"https://api.github.com/repos/zimmski/errcheck/issues/events{/number}","events_url":"https://api.github.com/repos/zimmski/errcheck/events","assignees_url":"https://api.github.com/repos/zimmski/errcheck/assignees{/user}","branches_url":"https://api.github.com/repos/zimmski/errcheck/branches{/branch}","tags_url":"https://api.github.com/repos/zimmski/errcheck/tags","blobs_url":"https://api.github.com/repos/zimmski/errcheck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zimmski/errcheck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zimmski/errcheck/git/refs{/sha}","trees_url":"https://api.github.com/repos/zimmski/errcheck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zimmski/errcheck/statuses/{sha}","languages_url":"https://api.github.com/repos/zimmski/errcheck/languages","stargazers_url":"https://api.github.com/repos/zimmski/errcheck/stargazers","contributors_url":"https://api.github.com/repos/zimmski/errcheck/contributors","subscribers_url":"https://api.github.com/repos/zimmski/errcheck/subscribers","subscription_url":"https://api.github.com/repos/zimmski/errcheck/subscription","commits_url":"https://api.github.com/repos/zimmski/errcheck/commits{/sha}","git_commits_url":"https://api.github.com/repos/zimmski/errcheck/git/commits{/sha}","comments_url":"https://api.github.com/repos/zimmski/errcheck/comments{/number}","issue_comment_url":"https://api.github.com/repos/zimmski/errcheck/issues/comments/{number}","contents_url":"https://api.github.com/repos/zimmski/errcheck/contents/{+path}","compare_url":"https://api.github.com/repos/zimmski/errcheck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zimmski/errcheck/merges","archive_url":"https://api.github.com/repos/zimmski/errcheck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zimmski/errcheck/downloads","issues_url":"https://api.github.com/repos/zimmski/errcheck/issues{/number}","pulls_url":"https://api.github.com/repos/zimmski/errcheck/pulls{/number}","milestones_url":"https://api.github.com/repos/zimmski/errcheck/milestones{/number}","notifications_url":"https://api.github.com/repos/zimmski/errcheck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zimmski/errcheck/labels{/name}","releases_url":"https://api.github.com/repos/zimmski/errcheck/releases{/id}","created_at":"2014-10-02T14:46:34Z","updated_at":"2015-01-23T16:19:59Z","pushed_at":"2015-01-23T20:16:02Z","git_url":"git://github.com/zimmski/errcheck.git","ssh_url":"git@github.com:zimmski/errcheck.git","clone_url":"https://github.com/zimmski/errcheck.git","svn_url":"https://github.com/zimmski/errcheck","homepage":null,"size":574,"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":"kisielk:master","ref":"master","sha":"2e6ea5cc92c8f90a7ec0c732d5d133d7b36a2c48","user":{"login":"kisielk","id":58618,"avatar_url":"https://avatars.githubusercontent.com/u/58618?v=3","gravatar_id":"","url":"https://api.github.com/users/kisielk","html_url":"https://github.com/kisielk","followers_url":"https://api.github.com/users/kisielk/followers","following_url":"https://api.github.com/users/kisielk/following{/other_user}","gists_url":"https://api.github.com/users/kisielk/gists{/gist_id}","starred_url":"https://api.github.com/users/kisielk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kisielk/subscriptions","organizations_url":"https://api.github.com/users/kisielk/orgs","repos_url":"https://api.github.com/users/kisielk/repos","events_url":"https://api.github.com/users/kisielk/events{/privacy}","received_events_url":"https://api.github.com/users/kisielk/received_events","type":"User","site_admin":false},"repo":{"id":8397993,"name":"errcheck","full_name":"kisielk/errcheck","owner":{"login":"kisielk","id":58618,"avatar_url":"https://avatars.githubusercontent.com/u/58618?v=3","gravatar_id":"","url":"https://api.github.com/users/kisielk","html_url":"https://github.com/kisielk","followers_url":"https://api.github.com/users/kisielk/followers","following_url":"https://api.github.com/users/kisielk/following{/other_user}","gists_url":"https://api.github.com/users/kisielk/gists{/gist_id}","starred_url":"https://api.github.com/users/kisielk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kisielk/subscriptions","organizations_url":"https://api.github.com/users/kisielk/orgs","repos_url":"https://api.github.com/users/kisielk/repos","events_url":"https://api.github.com/users/kisielk/events{/privacy}","received_events_url":"https://api.github.com/users/kisielk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kisielk/errcheck","description":"errcheck checks that you checked errors.","fork":false,"url":"https://api.github.com/repos/kisielk/errcheck","forks_url":"https://api.github.com/repos/kisielk/errcheck/forks","keys_url":"https://api.github.com/repos/kisielk/errcheck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kisielk/errcheck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kisielk/errcheck/teams","hooks_url":"https://api.github.com/repos/kisielk/errcheck/hooks","issue_events_url":"https://api.github.com/repos/kisielk/errcheck/issues/events{/number}","events_url":"https://api.github.com/repos/kisielk/errcheck/events","assignees_url":"https://api.github.com/repos/kisielk/errcheck/assignees{/user}","branches_url":"https://api.github.com/repos/kisielk/errcheck/branches{/branch}","tags_url":"https://api.github.com/repos/kisielk/errcheck/tags","blobs_url":"https://api.github.com/repos/kisielk/errcheck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kisielk/errcheck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kisielk/errcheck/git/refs{/sha}","trees_url":"https://api.github.com/repos/kisielk/errcheck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kisielk/errcheck/statuses/{sha}","languages_url":"https://api.github.com/repos/kisielk/errcheck/languages","stargazers_url":"https://api.github.com/repos/kisielk/errcheck/stargazers","contributors_url":"https://api.github.com/repos/kisielk/errcheck/contributors","subscribers_url":"https://api.github.com/repos/kisielk/errcheck/subscribers","subscription_url":"https://api.github.com/repos/kisielk/errcheck/subscription","commits_url":"https://api.github.com/repos/kisielk/errcheck/commits{/sha}","git_commits_url":"https://api.github.com/repos/kisielk/errcheck/git/commits{/sha}","comments_url":"https://api.github.com/repos/kisielk/errcheck/comments{/number}","issue_comment_url":"https://api.github.com/repos/kisielk/errcheck/issues/comments/{number}","contents_url":"https://api.github.com/repos/kisielk/errcheck/contents/{+path}","compare_url":"https://api.github.com/repos/kisielk/errcheck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kisielk/errcheck/merges","archive_url":"https://api.github.com/repos/kisielk/errcheck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kisielk/errcheck/downloads","issues_url":"https://api.github.com/repos/kisielk/errcheck/issues{/number}","pulls_url":"https://api.github.com/repos/kisielk/errcheck/pulls{/number}","milestones_url":"https://api.github.com/repos/kisielk/errcheck/milestones{/number}","notifications_url":"https://api.github.com/repos/kisielk/errcheck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kisielk/errcheck/labels{/name}","releases_url":"https://api.github.com/repos/kisielk/errcheck/releases{/id}","created_at":"2013-02-24T22:32:02Z","updated_at":"2015-01-23T20:15:24Z","pushed_at":"2015-01-23T22:24:53Z","git_url":"git://github.com/kisielk/errcheck.git","ssh_url":"git@github.com:kisielk/errcheck.git","clone_url":"https://github.com/kisielk/errcheck.git","svn_url":"https://github.com/kisielk/errcheck","homepage":null,"size":1000,"stargazers_count":302,"watchers_count":302,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":6,"forks":19,"open_issues":6,"watchers":302,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kisielk/errcheck/pulls/59"},"html":{"href":"https://github.com/kisielk/errcheck/pull/59"},"issue":{"href":"https://api.github.com/repos/kisielk/errcheck/issues/59"},"comments":{"href":"https://api.github.com/repos/kisielk/errcheck/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/kisielk/errcheck/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/kisielk/errcheck/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/kisielk/errcheck/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/kisielk/errcheck/statuses/3ba72342416f6b597511209a8be95097c8deae5a"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"kisielk","id":58618,"avatar_url":"https://avatars.githubusercontent.com/u/58618?v=3","gravatar_id":"","url":"https://api.github.com/users/kisielk","html_url":"https://github.com/kisielk","followers_url":"https://api.github.com/users/kisielk/followers","following_url":"https://api.github.com/users/kisielk/following{/other_user}","gists_url":"https://api.github.com/users/kisielk/gists{/gist_id}","starred_url":"https://api.github.com/users/kisielk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kisielk/subscriptions","organizations_url":"https://api.github.com/users/kisielk/orgs","repos_url":"https://api.github.com/users/kisielk/repos","events_url":"https://api.github.com/users/kisielk/events{/privacy}","received_events_url":"https://api.github.com/users/kisielk/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":84,"deletions":11,"changed_files":2}}