{"action":"created","comment":{"url":"https://api.github.com/repos/colinmarc/sequencefile/pulls/comments/75234537","id":75234537,"diff_hunk":"@@ -60,3 +60,38 @@ func mustReadByte(r io.Reader) (byte, error) {\n \n \treturn b, err\n }\n+\n+func WriteVInt(w io.Writer, n int64) error {\n+\tif n >= -112 && n <= 127 {\n+\t\t_, err := w.Write([]byte{byte(int8(n))})\n+\t\treturn err\n+\t}\n+\n+\tlength := -112\n+\tif n < 0 {\n+\t\tn = n ^ -1\n+\t\tlength = -120\n+\t}\n+\n+\ttmp := n\n+\tfor tmp != 0 {\n+\t\ttmp = tmp >> 8\n+\t\tlength--\n+\t}\n+\n+\tlengthByte := byte(int8(length))\n+\n+\tif length < -120 {\n+\t\tlength = -(length + 120)\n+\t} else {\n+\t\tlength = -(length + 112)\n+\t}\n+\n+\tb := make([]byte, length + 1)\n+\tb[0] = lengthByte\n+\tfor i := 1; i <= length; i++ {\n+\t    b[i] = byte(n >> uint(8 * (length - i)))","path":"vint.go","position":34,"original_position":34,"commit_id":"da3ad19e028eb91ee4b794964e446e49eca6942d","original_commit_id":"da91916d3b75a73f039d982a479ba963afca1b07","user":{"login":"kitchen","id":178765,"avatar_url":"https://avatars.githubusercontent.com/u/178765?v=3","gravatar_id":"","url":"https://api.github.com/users/kitchen","html_url":"https://github.com/kitchen","followers_url":"https://api.github.com/users/kitchen/followers","following_url":"https://api.github.com/users/kitchen/following{/other_user}","gists_url":"https://api.github.com/users/kitchen/gists{/gist_id}","starred_url":"https://api.github.com/users/kitchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitchen/subscriptions","organizations_url":"https://api.github.com/users/kitchen/orgs","repos_url":"https://api.github.com/users/kitchen/repos","events_url":"https://api.github.com/users/kitchen/events{/privacy}","received_events_url":"https://api.github.com/users/kitchen/received_events","type":"User","site_admin":false},"body":"whines about shift needing an unsigned value","created_at":"2016-08-18T01:05:39Z","updated_at":"2016-08-18T01:05:39Z","html_url":"https://github.com/colinmarc/sequencefile/pull/2#discussion_r75234537","pull_request_url":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/colinmarc/sequencefile/pulls/comments/75234537"},"html":{"href":"https://github.com/colinmarc/sequencefile/pull/2#discussion_r75234537"},"pull_request":{"href":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2","id":81731037,"html_url":"https://github.com/colinmarc/sequencefile/pull/2","diff_url":"https://github.com/colinmarc/sequencefile/pull/2.diff","patch_url":"https://github.com/colinmarc/sequencefile/pull/2.patch","issue_url":"https://api.github.com/repos/colinmarc/sequencefile/issues/2","number":2,"state":"open","locked":false,"title":"add a WriteVInt function","user":{"login":"kitchen","id":178765,"avatar_url":"https://avatars.githubusercontent.com/u/178765?v=3","gravatar_id":"","url":"https://api.github.com/users/kitchen","html_url":"https://github.com/kitchen","followers_url":"https://api.github.com/users/kitchen/followers","following_url":"https://api.github.com/users/kitchen/following{/other_user}","gists_url":"https://api.github.com/users/kitchen/gists{/gist_id}","starred_url":"https://api.github.com/users/kitchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitchen/subscriptions","organizations_url":"https://api.github.com/users/kitchen/orgs","repos_url":"https://api.github.com/users/kitchen/repos","events_url":"https://api.github.com/users/kitchen/events{/privacy}","received_events_url":"https://api.github.com/users/kitchen/received_events","type":"User","site_admin":false},"body":"this is one of the bits required to be able to write sequence files\r\n\r\nbasically a direct port of the java code from here: https://hadoop.apache.org/docs/r2.4.1/api/src-html/org/apache/hadoop/io/WritableUtils.html#line.273","created_at":"2016-08-17T22:52:59Z","updated_at":"2016-08-18T01:05:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e7642a7431a68b17c8eec2c5cd52563855b7de4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2/commits","review_comments_url":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2/comments","review_comment_url":"https://api.github.com/repos/colinmarc/sequencefile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/colinmarc/sequencefile/issues/2/comments","statuses_url":"https://api.github.com/repos/colinmarc/sequencefile/statuses/da3ad19e028eb91ee4b794964e446e49eca6942d","head":{"label":"kitchen:jeremy/vint-writer","ref":"jeremy/vint-writer","sha":"da3ad19e028eb91ee4b794964e446e49eca6942d","user":{"login":"kitchen","id":178765,"avatar_url":"https://avatars.githubusercontent.com/u/178765?v=3","gravatar_id":"","url":"https://api.github.com/users/kitchen","html_url":"https://github.com/kitchen","followers_url":"https://api.github.com/users/kitchen/followers","following_url":"https://api.github.com/users/kitchen/following{/other_user}","gists_url":"https://api.github.com/users/kitchen/gists{/gist_id}","starred_url":"https://api.github.com/users/kitchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitchen/subscriptions","organizations_url":"https://api.github.com/users/kitchen/orgs","repos_url":"https://api.github.com/users/kitchen/repos","events_url":"https://api.github.com/users/kitchen/events{/privacy}","received_events_url":"https://api.github.com/users/kitchen/received_events","type":"User","site_admin":false},"repo":{"id":65931146,"name":"sequencefile","full_name":"kitchen/sequencefile","owner":{"login":"kitchen","id":178765,"avatar_url":"https://avatars.githubusercontent.com/u/178765?v=3","gravatar_id":"","url":"https://api.github.com/users/kitchen","html_url":"https://github.com/kitchen","followers_url":"https://api.github.com/users/kitchen/followers","following_url":"https://api.github.com/users/kitchen/following{/other_user}","gists_url":"https://api.github.com/users/kitchen/gists{/gist_id}","starred_url":"https://api.github.com/users/kitchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitchen/subscriptions","organizations_url":"https://api.github.com/users/kitchen/orgs","repos_url":"https://api.github.com/users/kitchen/repos","events_url":"https://api.github.com/users/kitchen/events{/privacy}","received_events_url":"https://api.github.com/users/kitchen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kitchen/sequencefile","description":" A go library for using Hadoop's SequenceFiles","fork":true,"url":"https://api.github.com/repos/kitchen/sequencefile","forks_url":"https://api.github.com/repos/kitchen/sequencefile/forks","keys_url":"https://api.github.com/repos/kitchen/sequencefile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kitchen/sequencefile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kitchen/sequencefile/teams","hooks_url":"https://api.github.com/repos/kitchen/sequencefile/hooks","issue_events_url":"https://api.github.com/repos/kitchen/sequencefile/issues/events{/number}","events_url":"https://api.github.com/repos/kitchen/sequencefile/events","assignees_url":"https://api.github.com/repos/kitchen/sequencefile/assignees{/user}","branches_url":"https://api.github.com/repos/kitchen/sequencefile/branches{/branch}","tags_url":"https://api.github.com/repos/kitchen/sequencefile/tags","blobs_url":"https://api.github.com/repos/kitchen/sequencefile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kitchen/sequencefile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kitchen/sequencefile/git/refs{/sha}","trees_url":"https://api.github.com/repos/kitchen/sequencefile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kitchen/sequencefile/statuses/{sha}","languages_url":"https://api.github.com/repos/kitchen/sequencefile/languages","stargazers_url":"https://api.github.com/repos/kitchen/sequencefile/stargazers","contributors_url":"https://api.github.com/repos/kitchen/sequencefile/contributors","subscribers_url":"https://api.github.com/repos/kitchen/sequencefile/subscribers","subscription_url":"https://api.github.com/repos/kitchen/sequencefile/subscription","commits_url":"https://api.github.com/repos/kitchen/sequencefile/commits{/sha}","git_commits_url":"https://api.github.com/repos/kitchen/sequencefile/git/commits{/sha}","comments_url":"https://api.github.com/repos/kitchen/sequencefile/comments{/number}","issue_comment_url":"https://api.github.com/repos/kitchen/sequencefile/issues/comments{/number}","contents_url":"https://api.github.com/repos/kitchen/sequencefile/contents/{+path}","compare_url":"https://api.github.com/repos/kitchen/sequencefile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kitchen/sequencefile/merges","archive_url":"https://api.github.com/repos/kitchen/sequencefile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kitchen/sequencefile/downloads","issues_url":"https://api.github.com/repos/kitchen/sequencefile/issues{/number}","pulls_url":"https://api.github.com/repos/kitchen/sequencefile/pulls{/number}","milestones_url":"https://api.github.com/repos/kitchen/sequencefile/milestones{/number}","notifications_url":"https://api.github.com/repos/kitchen/sequencefile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kitchen/sequencefile/labels{/name}","releases_url":"https://api.github.com/repos/kitchen/sequencefile/releases{/id}","deployments_url":"https://api.github.com/repos/kitchen/sequencefile/deployments","created_at":"2016-08-17T18:12:13Z","updated_at":"2016-08-17T18:12:14Z","pushed_at":"2016-08-18T01:04:20Z","git_url":"git://github.com/kitchen/sequencefile.git","ssh_url":"git@github.com:kitchen/sequencefile.git","clone_url":"https://github.com/kitchen/sequencefile.git","svn_url":"https://github.com/kitchen/sequencefile","homepage":null,"size":91,"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":"colinmarc:master","ref":"master","sha":"1b9a884c88da07bef4eb54a82a94ef2e196a2c89","user":{"login":"colinmarc","id":821775,"avatar_url":"https://avatars.githubusercontent.com/u/821775?v=3","gravatar_id":"","url":"https://api.github.com/users/colinmarc","html_url":"https://github.com/colinmarc","followers_url":"https://api.github.com/users/colinmarc/followers","following_url":"https://api.github.com/users/colinmarc/following{/other_user}","gists_url":"https://api.github.com/users/colinmarc/gists{/gist_id}","starred_url":"https://api.github.com/users/colinmarc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinmarc/subscriptions","organizations_url":"https://api.github.com/users/colinmarc/orgs","repos_url":"https://api.github.com/users/colinmarc/repos","events_url":"https://api.github.com/users/colinmarc/events{/privacy}","received_events_url":"https://api.github.com/users/colinmarc/received_events","type":"User","site_admin":false},"repo":{"id":64110494,"name":"sequencefile","full_name":"colinmarc/sequencefile","owner":{"login":"colinmarc","id":821775,"avatar_url":"https://avatars.githubusercontent.com/u/821775?v=3","gravatar_id":"","url":"https://api.github.com/users/colinmarc","html_url":"https://github.com/colinmarc","followers_url":"https://api.github.com/users/colinmarc/followers","following_url":"https://api.github.com/users/colinmarc/following{/other_user}","gists_url":"https://api.github.com/users/colinmarc/gists{/gist_id}","starred_url":"https://api.github.com/users/colinmarc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinmarc/subscriptions","organizations_url":"https://api.github.com/users/colinmarc/orgs","repos_url":"https://api.github.com/users/colinmarc/repos","events_url":"https://api.github.com/users/colinmarc/events{/privacy}","received_events_url":"https://api.github.com/users/colinmarc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/colinmarc/sequencefile","description":" A go library for using Hadoop's SequenceFiles","fork":false,"url":"https://api.github.com/repos/colinmarc/sequencefile","forks_url":"https://api.github.com/repos/colinmarc/sequencefile/forks","keys_url":"https://api.github.com/repos/colinmarc/sequencefile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/colinmarc/sequencefile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/colinmarc/sequencefile/teams","hooks_url":"https://api.github.com/repos/colinmarc/sequencefile/hooks","issue_events_url":"https://api.github.com/repos/colinmarc/sequencefile/issues/events{/number}","events_url":"https://api.github.com/repos/colinmarc/sequencefile/events","assignees_url":"https://api.github.com/repos/colinmarc/sequencefile/assignees{/user}","branches_url":"https://api.github.com/repos/colinmarc/sequencefile/branches{/branch}","tags_url":"https://api.github.com/repos/colinmarc/sequencefile/tags","blobs_url":"https://api.github.com/repos/colinmarc/sequencefile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/colinmarc/sequencefile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/colinmarc/sequencefile/git/refs{/sha}","trees_url":"https://api.github.com/repos/colinmarc/sequencefile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/colinmarc/sequencefile/statuses/{sha}","languages_url":"https://api.github.com/repos/colinmarc/sequencefile/languages","stargazers_url":"https://api.github.com/repos/colinmarc/sequencefile/stargazers","contributors_url":"https://api.github.com/repos/colinmarc/sequencefile/contributors","subscribers_url":"https://api.github.com/repos/colinmarc/sequencefile/subscribers","subscription_url":"https://api.github.com/repos/colinmarc/sequencefile/subscription","commits_url":"https://api.github.com/repos/colinmarc/sequencefile/commits{/sha}","git_commits_url":"https://api.github.com/repos/colinmarc/sequencefile/git/commits{/sha}","comments_url":"https://api.github.com/repos/colinmarc/sequencefile/comments{/number}","issue_comment_url":"https://api.github.com/repos/colinmarc/sequencefile/issues/comments{/number}","contents_url":"https://api.github.com/repos/colinmarc/sequencefile/contents/{+path}","compare_url":"https://api.github.com/repos/colinmarc/sequencefile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/colinmarc/sequencefile/merges","archive_url":"https://api.github.com/repos/colinmarc/sequencefile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/colinmarc/sequencefile/downloads","issues_url":"https://api.github.com/repos/colinmarc/sequencefile/issues{/number}","pulls_url":"https://api.github.com/repos/colinmarc/sequencefile/pulls{/number}","milestones_url":"https://api.github.com/repos/colinmarc/sequencefile/milestones{/number}","notifications_url":"https://api.github.com/repos/colinmarc/sequencefile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/colinmarc/sequencefile/labels{/name}","releases_url":"https://api.github.com/repos/colinmarc/sequencefile/releases{/id}","deployments_url":"https://api.github.com/repos/colinmarc/sequencefile/deployments","created_at":"2016-07-25T06:47:57Z","updated_at":"2016-07-25T06:48:12Z","pushed_at":"2016-08-18T01:04:21Z","git_url":"git://github.com/colinmarc/sequencefile.git","ssh_url":"git@github.com:colinmarc/sequencefile.git","clone_url":"https://github.com/colinmarc/sequencefile.git","svn_url":"https://github.com/colinmarc/sequencefile","homepage":null,"size":95,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2"},"html":{"href":"https://github.com/colinmarc/sequencefile/pull/2"},"issue":{"href":"https://api.github.com/repos/colinmarc/sequencefile/issues/2"},"comments":{"href":"https://api.github.com/repos/colinmarc/sequencefile/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/colinmarc/sequencefile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/colinmarc/sequencefile/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/colinmarc/sequencefile/statuses/da3ad19e028eb91ee4b794964e446e49eca6942d"}}}}
{"actor":{"display_login":"kitchen"}}