{"action":"created","comment":{"url":"https://api.github.com/repos/vmware/govmomi/pulls/comments/38769206","id":38769206,"diff_hunk":"@@ -0,0 +1,101 @@\n+/*\n+Copyright (c) 2015 VMware, Inc. All Rights Reserved.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package units\n+\n+import (\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"math\"\n+\t\"regexp\"\n+\t\"strconv\"\n+)\n+\n+type ByteSize float64","path":"units/size.go","position":27,"original_position":27,"commit_id":"1da38eb13a903b7738ab3e954062346a43a20837","original_commit_id":"ab0190e4f5d2cfaf9c828fda13b55c023744f150","user":{"login":"pietern","id":9845,"avatar_url":"https://avatars.githubusercontent.com/u/9845?v=3","gravatar_id":"","url":"https://api.github.com/users/pietern","html_url":"https://github.com/pietern","followers_url":"https://api.github.com/users/pietern/followers","following_url":"https://api.github.com/users/pietern/following{/other_user}","gists_url":"https://api.github.com/users/pietern/gists{/gist_id}","starred_url":"https://api.github.com/users/pietern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pietern/subscriptions","organizations_url":"https://api.github.com/users/pietern/orgs","repos_url":"https://api.github.com/users/pietern/repos","events_url":"https://api.github.com/users/pietern/events{/privacy}","received_events_url":"https://api.github.com/users/pietern/received_events","type":"User","site_admin":false},"body":"Yep, you're right. You can still parse the first case as a float and then do the math until you arrive at an integer or have to round off (in case you get fractional bytes...). As long as the backing type is an integer.","created_at":"2015-09-04T16:30:14Z","updated_at":"2015-09-04T16:30:14Z","html_url":"https://github.com/vmware/govmomi/pull/317#discussion_r38769206","pull_request_url":"https://api.github.com/repos/vmware/govmomi/pulls/317","_links":{"self":{"href":"https://api.github.com/repos/vmware/govmomi/pulls/comments/38769206"},"html":{"href":"https://github.com/vmware/govmomi/pull/317#discussion_r38769206"},"pull_request":{"href":"https://api.github.com/repos/vmware/govmomi/pulls/317"}}},"pull_request":{"url":"https://api.github.com/repos/vmware/govmomi/pulls/317","id":44026599,"html_url":"https://github.com/vmware/govmomi/pull/317","diff_url":"https://github.com/vmware/govmomi/pull/317.diff","patch_url":"https://github.com/vmware/govmomi/pull/317.patch","issue_url":"https://api.github.com/repos/vmware/govmomi/issues/317","number":317,"state":"open","locked":false,"title":"Added common method of humanizing byte strings","user":{"login":"bruceadowns","id":1503908,"avatar_url":"https://avatars.githubusercontent.com/u/1503908?v=3","gravatar_id":"","url":"https://api.github.com/users/bruceadowns","html_url":"https://github.com/bruceadowns","followers_url":"https://api.github.com/users/bruceadowns/followers","following_url":"https://api.github.com/users/bruceadowns/following{/other_user}","gists_url":"https://api.github.com/users/bruceadowns/gists{/gist_id}","starred_url":"https://api.github.com/users/bruceadowns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruceadowns/subscriptions","organizations_url":"https://api.github.com/users/bruceadowns/orgs","repos_url":"https://api.github.com/users/bruceadowns/repos","events_url":"https://api.github.com/users/bruceadowns/events{/privacy}","received_events_url":"https://api.github.com/users/bruceadowns/received_events","type":"User","site_admin":false},"body":"* added units package\r\n* added ByteSize type as float64\r\n* added String() receiver for ByteSize\r\n* modified datastore.ls and datastore example to use new method","created_at":"2015-09-02T18:36:08Z","updated_at":"2015-09-04T16:30:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e33fa8ba934b2df1bd97bc29786c8f296f96e6cb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vmware/govmomi/pulls/317/commits","review_comments_url":"https://api.github.com/repos/vmware/govmomi/pulls/317/comments","review_comment_url":"https://api.github.com/repos/vmware/govmomi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vmware/govmomi/issues/317/comments","statuses_url":"https://api.github.com/repos/vmware/govmomi/statuses/1da38eb13a903b7738ab3e954062346a43a20837","head":{"label":"bruceadowns:cleanup","ref":"cleanup","sha":"1da38eb13a903b7738ab3e954062346a43a20837","user":{"login":"bruceadowns","id":1503908,"avatar_url":"https://avatars.githubusercontent.com/u/1503908?v=3","gravatar_id":"","url":"https://api.github.com/users/bruceadowns","html_url":"https://github.com/bruceadowns","followers_url":"https://api.github.com/users/bruceadowns/followers","following_url":"https://api.github.com/users/bruceadowns/following{/other_user}","gists_url":"https://api.github.com/users/bruceadowns/gists{/gist_id}","starred_url":"https://api.github.com/users/bruceadowns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruceadowns/subscriptions","organizations_url":"https://api.github.com/users/bruceadowns/orgs","repos_url":"https://api.github.com/users/bruceadowns/repos","events_url":"https://api.github.com/users/bruceadowns/events{/privacy}","received_events_url":"https://api.github.com/users/bruceadowns/received_events","type":"User","site_admin":false},"repo":{"id":40323542,"name":"govmomi","full_name":"bruceadowns/govmomi","owner":{"login":"bruceadowns","id":1503908,"avatar_url":"https://avatars.githubusercontent.com/u/1503908?v=3","gravatar_id":"","url":"https://api.github.com/users/bruceadowns","html_url":"https://github.com/bruceadowns","followers_url":"https://api.github.com/users/bruceadowns/followers","following_url":"https://api.github.com/users/bruceadowns/following{/other_user}","gists_url":"https://api.github.com/users/bruceadowns/gists{/gist_id}","starred_url":"https://api.github.com/users/bruceadowns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruceadowns/subscriptions","organizations_url":"https://api.github.com/users/bruceadowns/orgs","repos_url":"https://api.github.com/users/bruceadowns/repos","events_url":"https://api.github.com/users/bruceadowns/events{/privacy}","received_events_url":"https://api.github.com/users/bruceadowns/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bruceadowns/govmomi","description":"Go library for the VMware vSphere API","fork":true,"url":"https://api.github.com/repos/bruceadowns/govmomi","forks_url":"https://api.github.com/repos/bruceadowns/govmomi/forks","keys_url":"https://api.github.com/repos/bruceadowns/govmomi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bruceadowns/govmomi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bruceadowns/govmomi/teams","hooks_url":"https://api.github.com/repos/bruceadowns/govmomi/hooks","issue_events_url":"https://api.github.com/repos/bruceadowns/govmomi/issues/events{/number}","events_url":"https://api.github.com/repos/bruceadowns/govmomi/events","assignees_url":"https://api.github.com/repos/bruceadowns/govmomi/assignees{/user}","branches_url":"https://api.github.com/repos/bruceadowns/govmomi/branches{/branch}","tags_url":"https://api.github.com/repos/bruceadowns/govmomi/tags","blobs_url":"https://api.github.com/repos/bruceadowns/govmomi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bruceadowns/govmomi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bruceadowns/govmomi/git/refs{/sha}","trees_url":"https://api.github.com/repos/bruceadowns/govmomi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bruceadowns/govmomi/statuses/{sha}","languages_url":"https://api.github.com/repos/bruceadowns/govmomi/languages","stargazers_url":"https://api.github.com/repos/bruceadowns/govmomi/stargazers","contributors_url":"https://api.github.com/repos/bruceadowns/govmomi/contributors","subscribers_url":"https://api.github.com/repos/bruceadowns/govmomi/subscribers","subscription_url":"https://api.github.com/repos/bruceadowns/govmomi/subscription","commits_url":"https://api.github.com/repos/bruceadowns/govmomi/commits{/sha}","git_commits_url":"https://api.github.com/repos/bruceadowns/govmomi/git/commits{/sha}","comments_url":"https://api.github.com/repos/bruceadowns/govmomi/comments{/number}","issue_comment_url":"https://api.github.com/repos/bruceadowns/govmomi/issues/comments{/number}","contents_url":"https://api.github.com/repos/bruceadowns/govmomi/contents/{+path}","compare_url":"https://api.github.com/repos/bruceadowns/govmomi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bruceadowns/govmomi/merges","archive_url":"https://api.github.com/repos/bruceadowns/govmomi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bruceadowns/govmomi/downloads","issues_url":"https://api.github.com/repos/bruceadowns/govmomi/issues{/number}","pulls_url":"https://api.github.com/repos/bruceadowns/govmomi/pulls{/number}","milestones_url":"https://api.github.com/repos/bruceadowns/govmomi/milestones{/number}","notifications_url":"https://api.github.com/repos/bruceadowns/govmomi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bruceadowns/govmomi/labels{/name}","releases_url":"https://api.github.com/repos/bruceadowns/govmomi/releases{/id}","created_at":"2015-08-06T19:41:19Z","updated_at":"2015-08-06T19:41:20Z","pushed_at":"2015-09-04T15:43:59Z","git_url":"git://github.com/bruceadowns/govmomi.git","ssh_url":"git@github.com:bruceadowns/govmomi.git","clone_url":"https://github.com/bruceadowns/govmomi.git","svn_url":"https://github.com/bruceadowns/govmomi","homepage":"","size":1588,"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":"vmware:master","ref":"master","sha":"bc71d6485fa6c1cf598c9cc9f9365a028df399e4","user":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"repo":{"id":22883982,"name":"govmomi","full_name":"vmware/govmomi","owner":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vmware/govmomi","description":"Go library for the VMware vSphere API","fork":false,"url":"https://api.github.com/repos/vmware/govmomi","forks_url":"https://api.github.com/repos/vmware/govmomi/forks","keys_url":"https://api.github.com/repos/vmware/govmomi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/govmomi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/govmomi/teams","hooks_url":"https://api.github.com/repos/vmware/govmomi/hooks","issue_events_url":"https://api.github.com/repos/vmware/govmomi/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/govmomi/events","assignees_url":"https://api.github.com/repos/vmware/govmomi/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/govmomi/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/govmomi/tags","blobs_url":"https://api.github.com/repos/vmware/govmomi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/govmomi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/govmomi/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/govmomi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/govmomi/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/govmomi/languages","stargazers_url":"https://api.github.com/repos/vmware/govmomi/stargazers","contributors_url":"https://api.github.com/repos/vmware/govmomi/contributors","subscribers_url":"https://api.github.com/repos/vmware/govmomi/subscribers","subscription_url":"https://api.github.com/repos/vmware/govmomi/subscription","commits_url":"https://api.github.com/repos/vmware/govmomi/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/govmomi/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/govmomi/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/govmomi/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/govmomi/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/govmomi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/govmomi/merges","archive_url":"https://api.github.com/repos/vmware/govmomi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/govmomi/downloads","issues_url":"https://api.github.com/repos/vmware/govmomi/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/govmomi/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/govmomi/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/govmomi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/govmomi/labels{/name}","releases_url":"https://api.github.com/repos/vmware/govmomi/releases{/id}","created_at":"2014-08-12T16:15:08Z","updated_at":"2015-08-28T21:48:47Z","pushed_at":"2015-09-04T15:43:59Z","git_url":"git://github.com/vmware/govmomi.git","ssh_url":"git@github.com:vmware/govmomi.git","clone_url":"https://github.com/vmware/govmomi.git","svn_url":"https://github.com/vmware/govmomi","homepage":"","size":3154,"stargazers_count":165,"watchers_count":165,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":27,"forks":49,"open_issues":27,"watchers":165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vmware/govmomi/pulls/317"},"html":{"href":"https://github.com/vmware/govmomi/pull/317"},"issue":{"href":"https://api.github.com/repos/vmware/govmomi/issues/317"},"comments":{"href":"https://api.github.com/repos/vmware/govmomi/issues/317/comments"},"review_comments":{"href":"https://api.github.com/repos/vmware/govmomi/pulls/317/comments"},"review_comment":{"href":"https://api.github.com/repos/vmware/govmomi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vmware/govmomi/pulls/317/commits"},"statuses":{"href":"https://api.github.com/repos/vmware/govmomi/statuses/1da38eb13a903b7738ab3e954062346a43a20837"}}}}