{"action":"created","comment":{"url":"https://api.github.com/repos/itsabot/abot/pulls/comments/59051947","id":59051947,"diff_hunk":"@@ -173,26 +154,17 @@ func ExtractAddress(db *sqlx.DB, u *dt.User, s string) (*dt.Address, bool,\n // ExtractCount returns a number from a user's message, useful in situations\n // like:\n //\tAva>  How many would you like to buy?\n-//\tUser> Order 5.\n-//\n-// TODO this should return an *int64 to maintain consistency with the Extract\n-// API.\n-func ExtractCount(s string) sql.NullInt64 {\n-\tn := sql.NullInt64{\n-\t\tInt64: 0,\n-\t\tValid: false,\n-\t}\n+//\tUser> Order 5\n+func ExtractCount(s string) (int64, error) {\n \ts = regexNum.FindString(s)\n-\tif len(s) == 0 {\n-\t\treturn n\n+\tif s == \"\" {\n+\t\treturn 0, ErrNotFound\n \t}\n-\tval, err := strconv.ParseUint(s, 10, 64)\n-\tif err != nil {\n-\t\treturn n\n+\tif val, err := strconv.ParseInt(s, 10, 64); err == nil {\n+\t\treturn val, nil\n+\t} else {","path":"shared/language/extract.go","position":153,"original_position":153,"commit_id":"bb8f1b3d996a5d1dd0a274ad36f1cf389d51dcae","original_commit_id":"bb8f1b3d996a5d1dd0a274ad36f1cf389d51dcae","user":{"login":"egtann","id":577672,"avatar_url":"https://avatars.githubusercontent.com/u/577672?v=3","gravatar_id":"","url":"https://api.github.com/users/egtann","html_url":"https://github.com/egtann","followers_url":"https://api.github.com/users/egtann/followers","following_url":"https://api.github.com/users/egtann/following{/other_user}","gists_url":"https://api.github.com/users/egtann/gists{/gist_id}","starred_url":"https://api.github.com/users/egtann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egtann/subscriptions","organizations_url":"https://api.github.com/users/egtann/orgs","repos_url":"https://api.github.com/users/egtann/repos","events_url":"https://api.github.com/users/egtann/events{/privacy}","received_events_url":"https://api.github.com/users/egtann/received_events","type":"User","site_admin":false},"body":"No need for an else block when the if block returns. But it should be err != nil.","created_at":"2016-04-08T16:28:39Z","updated_at":"2016-04-08T16:28:39Z","html_url":"https://github.com/itsabot/abot/pull/50#discussion_r59051947","pull_request_url":"https://api.github.com/repos/itsabot/abot/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/itsabot/abot/pulls/comments/59051947"},"html":{"href":"https://github.com/itsabot/abot/pull/50#discussion_r59051947"},"pull_request":{"href":"https://api.github.com/repos/itsabot/abot/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/itsabot/abot/pulls/50","id":65687294,"html_url":"https://github.com/itsabot/abot/pull/50","diff_url":"https://github.com/itsabot/abot/pull/50.diff","patch_url":"https://github.com/itsabot/abot/pull/50.patch","issue_url":"https://api.github.com/repos/itsabot/abot/issues/50","number":50,"state":"open","locked":false,"title":"Extract API Fix","user":{"login":"njaremko","id":3753178,"avatar_url":"https://avatars.githubusercontent.com/u/3753178?v=3","gravatar_id":"","url":"https://api.github.com/users/njaremko","html_url":"https://github.com/njaremko","followers_url":"https://api.github.com/users/njaremko/followers","following_url":"https://api.github.com/users/njaremko/following{/other_user}","gists_url":"https://api.github.com/users/njaremko/gists{/gist_id}","starred_url":"https://api.github.com/users/njaremko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njaremko/subscriptions","organizations_url":"https://api.github.com/users/njaremko/orgs","repos_url":"https://api.github.com/users/njaremko/repos","events_url":"https://api.github.com/users/njaremko/events{/privacy}","received_events_url":"https://api.github.com/users/njaremko/received_events","type":"User","site_admin":false},"body":"I was writing a plugin for Abot and found that the ExtractCurrency function was multiplying floats by 100 and returning an int instead of letting plugin authors deal with the desired float (which they can format later). \r\n\r\nSo I fixed that, and made the rest of the Extract API more idiomatic.","created_at":"2016-04-07T19:40:35Z","updated_at":"2016-04-08T16:28:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2621d1086f32a49a035a1c67ecd680ae45d72c7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/itsabot/abot/pulls/50/commits","review_comments_url":"https://api.github.com/repos/itsabot/abot/pulls/50/comments","review_comment_url":"https://api.github.com/repos/itsabot/abot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/itsabot/abot/issues/50/comments","statuses_url":"https://api.github.com/repos/itsabot/abot/statuses/bb8f1b3d996a5d1dd0a274ad36f1cf389d51dcae","head":{"label":"njaremko:extractFix","ref":"extractFix","sha":"bb8f1b3d996a5d1dd0a274ad36f1cf389d51dcae","user":{"login":"njaremko","id":3753178,"avatar_url":"https://avatars.githubusercontent.com/u/3753178?v=3","gravatar_id":"","url":"https://api.github.com/users/njaremko","html_url":"https://github.com/njaremko","followers_url":"https://api.github.com/users/njaremko/followers","following_url":"https://api.github.com/users/njaremko/following{/other_user}","gists_url":"https://api.github.com/users/njaremko/gists{/gist_id}","starred_url":"https://api.github.com/users/njaremko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njaremko/subscriptions","organizations_url":"https://api.github.com/users/njaremko/orgs","repos_url":"https://api.github.com/users/njaremko/repos","events_url":"https://api.github.com/users/njaremko/events{/privacy}","received_events_url":"https://api.github.com/users/njaremko/received_events","type":"User","site_admin":false},"repo":{"id":55518696,"name":"abot","full_name":"njaremko/abot","owner":{"login":"njaremko","id":3753178,"avatar_url":"https://avatars.githubusercontent.com/u/3753178?v=3","gravatar_id":"","url":"https://api.github.com/users/njaremko","html_url":"https://github.com/njaremko","followers_url":"https://api.github.com/users/njaremko/followers","following_url":"https://api.github.com/users/njaremko/following{/other_user}","gists_url":"https://api.github.com/users/njaremko/gists{/gist_id}","starred_url":"https://api.github.com/users/njaremko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njaremko/subscriptions","organizations_url":"https://api.github.com/users/njaremko/orgs","repos_url":"https://api.github.com/users/njaremko/repos","events_url":"https://api.github.com/users/njaremko/events{/privacy}","received_events_url":"https://api.github.com/users/njaremko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/njaremko/abot","description":"Abot makes it easy and fun to build your own digital assistant, and we include everything you need to get started.","fork":true,"url":"https://api.github.com/repos/njaremko/abot","forks_url":"https://api.github.com/repos/njaremko/abot/forks","keys_url":"https://api.github.com/repos/njaremko/abot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/njaremko/abot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/njaremko/abot/teams","hooks_url":"https://api.github.com/repos/njaremko/abot/hooks","issue_events_url":"https://api.github.com/repos/njaremko/abot/issues/events{/number}","events_url":"https://api.github.com/repos/njaremko/abot/events","assignees_url":"https://api.github.com/repos/njaremko/abot/assignees{/user}","branches_url":"https://api.github.com/repos/njaremko/abot/branches{/branch}","tags_url":"https://api.github.com/repos/njaremko/abot/tags","blobs_url":"https://api.github.com/repos/njaremko/abot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/njaremko/abot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/njaremko/abot/git/refs{/sha}","trees_url":"https://api.github.com/repos/njaremko/abot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/njaremko/abot/statuses/{sha}","languages_url":"https://api.github.com/repos/njaremko/abot/languages","stargazers_url":"https://api.github.com/repos/njaremko/abot/stargazers","contributors_url":"https://api.github.com/repos/njaremko/abot/contributors","subscribers_url":"https://api.github.com/repos/njaremko/abot/subscribers","subscription_url":"https://api.github.com/repos/njaremko/abot/subscription","commits_url":"https://api.github.com/repos/njaremko/abot/commits{/sha}","git_commits_url":"https://api.github.com/repos/njaremko/abot/git/commits{/sha}","comments_url":"https://api.github.com/repos/njaremko/abot/comments{/number}","issue_comment_url":"https://api.github.com/repos/njaremko/abot/issues/comments{/number}","contents_url":"https://api.github.com/repos/njaremko/abot/contents/{+path}","compare_url":"https://api.github.com/repos/njaremko/abot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/njaremko/abot/merges","archive_url":"https://api.github.com/repos/njaremko/abot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/njaremko/abot/downloads","issues_url":"https://api.github.com/repos/njaremko/abot/issues{/number}","pulls_url":"https://api.github.com/repos/njaremko/abot/pulls{/number}","milestones_url":"https://api.github.com/repos/njaremko/abot/milestones{/number}","notifications_url":"https://api.github.com/repos/njaremko/abot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/njaremko/abot/labels{/name}","releases_url":"https://api.github.com/repos/njaremko/abot/releases{/id}","deployments_url":"https://api.github.com/repos/njaremko/abot/deployments","created_at":"2016-04-05T15:16:35Z","updated_at":"2016-04-05T15:16:37Z","pushed_at":"2016-04-08T16:26:47Z","git_url":"git://github.com/njaremko/abot.git","ssh_url":"git@github.com:njaremko/abot.git","clone_url":"https://github.com/njaremko/abot.git","svn_url":"https://github.com/njaremko/abot","homepage":"https://www.itsabot.org","size":16276,"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":"itsabot:master","ref":"master","sha":"ac525fb270b36215bd1d7dd57838871d8fd59197","user":{"login":"itsabot","id":13785897,"avatar_url":"https://avatars.githubusercontent.com/u/13785897?v=3","gravatar_id":"","url":"https://api.github.com/users/itsabot","html_url":"https://github.com/itsabot","followers_url":"https://api.github.com/users/itsabot/followers","following_url":"https://api.github.com/users/itsabot/following{/other_user}","gists_url":"https://api.github.com/users/itsabot/gists{/gist_id}","starred_url":"https://api.github.com/users/itsabot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsabot/subscriptions","organizations_url":"https://api.github.com/users/itsabot/orgs","repos_url":"https://api.github.com/users/itsabot/repos","events_url":"https://api.github.com/users/itsabot/events{/privacy}","received_events_url":"https://api.github.com/users/itsabot/received_events","type":"Organization","site_admin":false},"repo":{"id":51855345,"name":"abot","full_name":"itsabot/abot","owner":{"login":"itsabot","id":13785897,"avatar_url":"https://avatars.githubusercontent.com/u/13785897?v=3","gravatar_id":"","url":"https://api.github.com/users/itsabot","html_url":"https://github.com/itsabot","followers_url":"https://api.github.com/users/itsabot/followers","following_url":"https://api.github.com/users/itsabot/following{/other_user}","gists_url":"https://api.github.com/users/itsabot/gists{/gist_id}","starred_url":"https://api.github.com/users/itsabot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsabot/subscriptions","organizations_url":"https://api.github.com/users/itsabot/orgs","repos_url":"https://api.github.com/users/itsabot/repos","events_url":"https://api.github.com/users/itsabot/events{/privacy}","received_events_url":"https://api.github.com/users/itsabot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/itsabot/abot","description":"Abot makes it easy and fun to build your own digital assistant, and we include everything you need to get started.","fork":false,"url":"https://api.github.com/repos/itsabot/abot","forks_url":"https://api.github.com/repos/itsabot/abot/forks","keys_url":"https://api.github.com/repos/itsabot/abot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/itsabot/abot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/itsabot/abot/teams","hooks_url":"https://api.github.com/repos/itsabot/abot/hooks","issue_events_url":"https://api.github.com/repos/itsabot/abot/issues/events{/number}","events_url":"https://api.github.com/repos/itsabot/abot/events","assignees_url":"https://api.github.com/repos/itsabot/abot/assignees{/user}","branches_url":"https://api.github.com/repos/itsabot/abot/branches{/branch}","tags_url":"https://api.github.com/repos/itsabot/abot/tags","blobs_url":"https://api.github.com/repos/itsabot/abot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/itsabot/abot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/itsabot/abot/git/refs{/sha}","trees_url":"https://api.github.com/repos/itsabot/abot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/itsabot/abot/statuses/{sha}","languages_url":"https://api.github.com/repos/itsabot/abot/languages","stargazers_url":"https://api.github.com/repos/itsabot/abot/stargazers","contributors_url":"https://api.github.com/repos/itsabot/abot/contributors","subscribers_url":"https://api.github.com/repos/itsabot/abot/subscribers","subscription_url":"https://api.github.com/repos/itsabot/abot/subscription","commits_url":"https://api.github.com/repos/itsabot/abot/commits{/sha}","git_commits_url":"https://api.github.com/repos/itsabot/abot/git/commits{/sha}","comments_url":"https://api.github.com/repos/itsabot/abot/comments{/number}","issue_comment_url":"https://api.github.com/repos/itsabot/abot/issues/comments{/number}","contents_url":"https://api.github.com/repos/itsabot/abot/contents/{+path}","compare_url":"https://api.github.com/repos/itsabot/abot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/itsabot/abot/merges","archive_url":"https://api.github.com/repos/itsabot/abot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/itsabot/abot/downloads","issues_url":"https://api.github.com/repos/itsabot/abot/issues{/number}","pulls_url":"https://api.github.com/repos/itsabot/abot/pulls{/number}","milestones_url":"https://api.github.com/repos/itsabot/abot/milestones{/number}","notifications_url":"https://api.github.com/repos/itsabot/abot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/itsabot/abot/labels{/name}","releases_url":"https://api.github.com/repos/itsabot/abot/releases{/id}","deployments_url":"https://api.github.com/repos/itsabot/abot/deployments","created_at":"2016-02-16T17:41:51Z","updated_at":"2016-04-08T15:12:03Z","pushed_at":"2016-04-08T16:26:48Z","git_url":"git://github.com/itsabot/abot.git","ssh_url":"git@github.com:itsabot/abot.git","clone_url":"https://github.com/itsabot/abot.git","svn_url":"https://github.com/itsabot/abot","homepage":"https://www.itsabot.org","size":16248,"stargazers_count":1646,"watchers_count":1646,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"open_issues_count":9,"forks":75,"open_issues":9,"watchers":1646,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/itsabot/abot/pulls/50"},"html":{"href":"https://github.com/itsabot/abot/pull/50"},"issue":{"href":"https://api.github.com/repos/itsabot/abot/issues/50"},"comments":{"href":"https://api.github.com/repos/itsabot/abot/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/itsabot/abot/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/itsabot/abot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/itsabot/abot/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/itsabot/abot/statuses/bb8f1b3d996a5d1dd0a274ad36f1cf389d51dcae"}}}}