{"action":"created","comment":{"url":"https://api.github.com/repos/chihaya/chihaya/pulls/comments/77851957","id":77851957,"diff_hunk":"@@ -36,124 +36,154 @@ type Marshaler interface {\n \tMarshalBencode() ([]byte, error)\n }\n \n-// marshal writes types bencoded to an io.Writer\n-func marshal(w io.Writer, data interface{}) error {\n+// marshal writes types bencoded to an io.Writer.\n+func marshal(w io.Writer, data interface{}) (err error) {\n \tswitch v := data.(type) {\n \tcase Marshaler:\n-\t\tbencoded, err := v.MarshalBencode()\n+\t\tvar bencoded []byte\n+\t\tbencoded, err = v.MarshalBencode()\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n \t\t_, err = w.Write(bencoded)\n-\t\tif err != nil {\n-\t\t\treturn err\n-\t\t}\n+\n+\tcase []byte:\n+\t\terr = marshalBytes(w, v)\n \n \tcase string:\n-\t\tmarshalString(w, v)\n+\t\terr = marshalString(w, v)\n \n-\tcase int:\n-\t\tmarshalInt(w, int64(v))\n+\tcase []string:","path":"frontend/http/bencode/encoder.go","position":41,"original_position":41,"commit_id":"2415bc71c6458a5eef731d379d885fd5a8f78fac","original_commit_id":"2415bc71c6458a5eef731d379d885fd5a8f78fac","user":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"body":"IIRC some of these extra definitions are for performance, but I doubt it makes any difference. I'll squash it down.","created_at":"2016-09-07T15:58:04Z","updated_at":"2016-09-07T15:58:04Z","html_url":"https://github.com/chihaya/chihaya/pull/217#discussion_r77851957","pull_request_url":"https://api.github.com/repos/chihaya/chihaya/pulls/217","_links":{"self":{"href":"https://api.github.com/repos/chihaya/chihaya/pulls/comments/77851957"},"html":{"href":"https://github.com/chihaya/chihaya/pull/217#discussion_r77851957"},"pull_request":{"href":"https://api.github.com/repos/chihaya/chihaya/pulls/217"}}},"pull_request":{"url":"https://api.github.com/repos/chihaya/chihaya/pulls/217","id":84232120,"html_url":"https://github.com/chihaya/chihaya/pull/217","diff_url":"https://github.com/chihaya/chihaya/pull/217.diff","patch_url":"https://github.com/chihaya/chihaya/pull/217.patch","issue_url":"https://api.github.com/repos/chihaya/chihaya/issues/217","number":217,"state":"open","locked":false,"title":"bencode: add missing error handling","user":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"body":"Go report card runs `gocyclo -n 15`, while trying to reduce the complexity of some of our calls, I noticed that the bencode encoder is ignoring all the errors from calling `Write`. This is fine if you're working with bytes.Buffer or memory, but if you were to use another instance of an io.Writer, it could fail silently.","created_at":"2016-09-07T03:42:16Z","updated_at":"2016-09-07T15:58:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f005947fde98e33ffa8e2f98cd351447387753b4","assignee":{"login":"mrd0ll4r","id":15063379,"avatar_url":"https://avatars.githubusercontent.com/u/15063379?v=3","gravatar_id":"","url":"https://api.github.com/users/mrd0ll4r","html_url":"https://github.com/mrd0ll4r","followers_url":"https://api.github.com/users/mrd0ll4r/followers","following_url":"https://api.github.com/users/mrd0ll4r/following{/other_user}","gists_url":"https://api.github.com/users/mrd0ll4r/gists{/gist_id}","starred_url":"https://api.github.com/users/mrd0ll4r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrd0ll4r/subscriptions","organizations_url":"https://api.github.com/users/mrd0ll4r/orgs","repos_url":"https://api.github.com/users/mrd0ll4r/repos","events_url":"https://api.github.com/users/mrd0ll4r/events{/privacy}","received_events_url":"https://api.github.com/users/mrd0ll4r/received_events","type":"User","site_admin":false},"assignees":[{"login":"mrd0ll4r","id":15063379,"avatar_url":"https://avatars.githubusercontent.com/u/15063379?v=3","gravatar_id":"","url":"https://api.github.com/users/mrd0ll4r","html_url":"https://github.com/mrd0ll4r","followers_url":"https://api.github.com/users/mrd0ll4r/followers","following_url":"https://api.github.com/users/mrd0ll4r/following{/other_user}","gists_url":"https://api.github.com/users/mrd0ll4r/gists{/gist_id}","starred_url":"https://api.github.com/users/mrd0ll4r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrd0ll4r/subscriptions","organizations_url":"https://api.github.com/users/mrd0ll4r/orgs","repos_url":"https://api.github.com/users/mrd0ll4r/repos","events_url":"https://api.github.com/users/mrd0ll4r/events{/privacy}","received_events_url":"https://api.github.com/users/mrd0ll4r/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/chihaya/chihaya/pulls/217/commits","review_comments_url":"https://api.github.com/repos/chihaya/chihaya/pulls/217/comments","review_comment_url":"https://api.github.com/repos/chihaya/chihaya/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chihaya/chihaya/issues/217/comments","statuses_url":"https://api.github.com/repos/chihaya/chihaya/statuses/2415bc71c6458a5eef731d379d885fd5a8f78fac","head":{"label":"jzelinskie:bencode","ref":"bencode","sha":"2415bc71c6458a5eef731d379d885fd5a8f78fac","user":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"repo":{"id":50328591,"name":"chihaya","full_name":"jzelinskie/chihaya","owner":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jzelinskie/chihaya","description":"my development fork of chihaya","fork":true,"url":"https://api.github.com/repos/jzelinskie/chihaya","forks_url":"https://api.github.com/repos/jzelinskie/chihaya/forks","keys_url":"https://api.github.com/repos/jzelinskie/chihaya/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jzelinskie/chihaya/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jzelinskie/chihaya/teams","hooks_url":"https://api.github.com/repos/jzelinskie/chihaya/hooks","issue_events_url":"https://api.github.com/repos/jzelinskie/chihaya/issues/events{/number}","events_url":"https://api.github.com/repos/jzelinskie/chihaya/events","assignees_url":"https://api.github.com/repos/jzelinskie/chihaya/assignees{/user}","branches_url":"https://api.github.com/repos/jzelinskie/chihaya/branches{/branch}","tags_url":"https://api.github.com/repos/jzelinskie/chihaya/tags","blobs_url":"https://api.github.com/repos/jzelinskie/chihaya/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jzelinskie/chihaya/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jzelinskie/chihaya/git/refs{/sha}","trees_url":"https://api.github.com/repos/jzelinskie/chihaya/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jzelinskie/chihaya/statuses/{sha}","languages_url":"https://api.github.com/repos/jzelinskie/chihaya/languages","stargazers_url":"https://api.github.com/repos/jzelinskie/chihaya/stargazers","contributors_url":"https://api.github.com/repos/jzelinskie/chihaya/contributors","subscribers_url":"https://api.github.com/repos/jzelinskie/chihaya/subscribers","subscription_url":"https://api.github.com/repos/jzelinskie/chihaya/subscription","commits_url":"https://api.github.com/repos/jzelinskie/chihaya/commits{/sha}","git_commits_url":"https://api.github.com/repos/jzelinskie/chihaya/git/commits{/sha}","comments_url":"https://api.github.com/repos/jzelinskie/chihaya/comments{/number}","issue_comment_url":"https://api.github.com/repos/jzelinskie/chihaya/issues/comments{/number}","contents_url":"https://api.github.com/repos/jzelinskie/chihaya/contents/{+path}","compare_url":"https://api.github.com/repos/jzelinskie/chihaya/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jzelinskie/chihaya/merges","archive_url":"https://api.github.com/repos/jzelinskie/chihaya/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jzelinskie/chihaya/downloads","issues_url":"https://api.github.com/repos/jzelinskie/chihaya/issues{/number}","pulls_url":"https://api.github.com/repos/jzelinskie/chihaya/pulls{/number}","milestones_url":"https://api.github.com/repos/jzelinskie/chihaya/milestones{/number}","notifications_url":"https://api.github.com/repos/jzelinskie/chihaya/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jzelinskie/chihaya/labels{/name}","releases_url":"https://api.github.com/repos/jzelinskie/chihaya/releases{/id}","deployments_url":"https://api.github.com/repos/jzelinskie/chihaya/deployments","created_at":"2016-01-25T05:36:10Z","updated_at":"2016-09-05T21:58:21Z","pushed_at":"2016-09-07T03:44:08Z","git_url":"git://github.com/jzelinskie/chihaya.git","ssh_url":"git@github.com:jzelinskie/chihaya.git","clone_url":"https://github.com/jzelinskie/chihaya.git","svn_url":"https://github.com/jzelinskie/chihaya","homepage":"","size":3015,"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":"chihaya:master","ref":"master","sha":"6b376e35221ac4c31a645e5e47617b33192e6314","user":{"login":"chihaya","id":6076200,"avatar_url":"https://avatars.githubusercontent.com/u/6076200?v=3","gravatar_id":"","url":"https://api.github.com/users/chihaya","html_url":"https://github.com/chihaya","followers_url":"https://api.github.com/users/chihaya/followers","following_url":"https://api.github.com/users/chihaya/following{/other_user}","gists_url":"https://api.github.com/users/chihaya/gists{/gist_id}","starred_url":"https://api.github.com/users/chihaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chihaya/subscriptions","organizations_url":"https://api.github.com/users/chihaya/orgs","repos_url":"https://api.github.com/users/chihaya/repos","events_url":"https://api.github.com/users/chihaya/events{/privacy}","received_events_url":"https://api.github.com/users/chihaya/received_events","type":"Organization","site_admin":false},"repo":{"id":7399031,"name":"chihaya","full_name":"chihaya/chihaya","owner":{"login":"chihaya","id":6076200,"avatar_url":"https://avatars.githubusercontent.com/u/6076200?v=3","gravatar_id":"","url":"https://api.github.com/users/chihaya","html_url":"https://github.com/chihaya","followers_url":"https://api.github.com/users/chihaya/followers","following_url":"https://api.github.com/users/chihaya/following{/other_user}","gists_url":"https://api.github.com/users/chihaya/gists{/gist_id}","starred_url":"https://api.github.com/users/chihaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chihaya/subscriptions","organizations_url":"https://api.github.com/users/chihaya/orgs","repos_url":"https://api.github.com/users/chihaya/repos","events_url":"https://api.github.com/users/chihaya/events{/privacy}","received_events_url":"https://api.github.com/users/chihaya/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chihaya/chihaya","description":"A customizible, multi-protocol BitTorrent Tracker","fork":false,"url":"https://api.github.com/repos/chihaya/chihaya","forks_url":"https://api.github.com/repos/chihaya/chihaya/forks","keys_url":"https://api.github.com/repos/chihaya/chihaya/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chihaya/chihaya/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chihaya/chihaya/teams","hooks_url":"https://api.github.com/repos/chihaya/chihaya/hooks","issue_events_url":"https://api.github.com/repos/chihaya/chihaya/issues/events{/number}","events_url":"https://api.github.com/repos/chihaya/chihaya/events","assignees_url":"https://api.github.com/repos/chihaya/chihaya/assignees{/user}","branches_url":"https://api.github.com/repos/chihaya/chihaya/branches{/branch}","tags_url":"https://api.github.com/repos/chihaya/chihaya/tags","blobs_url":"https://api.github.com/repos/chihaya/chihaya/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chihaya/chihaya/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chihaya/chihaya/git/refs{/sha}","trees_url":"https://api.github.com/repos/chihaya/chihaya/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chihaya/chihaya/statuses/{sha}","languages_url":"https://api.github.com/repos/chihaya/chihaya/languages","stargazers_url":"https://api.github.com/repos/chihaya/chihaya/stargazers","contributors_url":"https://api.github.com/repos/chihaya/chihaya/contributors","subscribers_url":"https://api.github.com/repos/chihaya/chihaya/subscribers","subscription_url":"https://api.github.com/repos/chihaya/chihaya/subscription","commits_url":"https://api.github.com/repos/chihaya/chihaya/commits{/sha}","git_commits_url":"https://api.github.com/repos/chihaya/chihaya/git/commits{/sha}","comments_url":"https://api.github.com/repos/chihaya/chihaya/comments{/number}","issue_comment_url":"https://api.github.com/repos/chihaya/chihaya/issues/comments{/number}","contents_url":"https://api.github.com/repos/chihaya/chihaya/contents/{+path}","compare_url":"https://api.github.com/repos/chihaya/chihaya/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chihaya/chihaya/merges","archive_url":"https://api.github.com/repos/chihaya/chihaya/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chihaya/chihaya/downloads","issues_url":"https://api.github.com/repos/chihaya/chihaya/issues{/number}","pulls_url":"https://api.github.com/repos/chihaya/chihaya/pulls{/number}","milestones_url":"https://api.github.com/repos/chihaya/chihaya/milestones{/number}","notifications_url":"https://api.github.com/repos/chihaya/chihaya/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chihaya/chihaya/labels{/name}","releases_url":"https://api.github.com/repos/chihaya/chihaya/releases{/id}","deployments_url":"https://api.github.com/repos/chihaya/chihaya/deployments","created_at":"2013-01-01T21:08:47Z","updated_at":"2016-09-06T19:33:15Z","pushed_at":"2016-09-07T03:44:09Z","git_url":"git://github.com/chihaya/chihaya.git","ssh_url":"git@github.com:chihaya/chihaya.git","clone_url":"https://github.com/chihaya/chihaya.git","svn_url":"https://github.com/chihaya/chihaya","homepage":"","size":6224,"stargazers_count":430,"watchers_count":430,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":14,"forks":48,"open_issues":14,"watchers":430,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chihaya/chihaya/pulls/217"},"html":{"href":"https://github.com/chihaya/chihaya/pull/217"},"issue":{"href":"https://api.github.com/repos/chihaya/chihaya/issues/217"},"comments":{"href":"https://api.github.com/repos/chihaya/chihaya/issues/217/comments"},"review_comments":{"href":"https://api.github.com/repos/chihaya/chihaya/pulls/217/comments"},"review_comment":{"href":"https://api.github.com/repos/chihaya/chihaya/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chihaya/chihaya/pulls/217/commits"},"statuses":{"href":"https://api.github.com/repos/chihaya/chihaya/statuses/2415bc71c6458a5eef731d379d885fd5a8f78fac"}}}}
{"actor":{"display_login":"jzelinskie"}}