{"action":"created","comment":{"url":"https://api.github.com/repos/NYTimes/gizmo/pulls/comments/79918984","id":79918984,"diff_hunk":"@@ -0,0 +1,45 @@\n+// +build go1.7\n+\n+package web\n+\n+import (\n+\t\"context\"\n+\t\"net/http\"\n+)\n+\n+// Vars is a helper function for accessing route\n+// parameters from any server.Router implementation. This is the equivalent\n+// of using `mux.Vars(r)` with the Gorilla mux.Router.\n+func Vars(r *http.Request) map[string]string {\n+\t// vars doesnt exist yet, return empty map\n+\trawVars := r.Context().Value(varsKey)\n+\tif rawVars == nil {\n+\t\treturn map[string]string{}\n+\t}\n+\n+\t// for some reason, vars is wrong type, return empty map\n+\tvars, ok := rawVars.(map[string]string)\n+\tif !ok {\n+\t\treturn map[string]string{}","path":"web/vars_native.go","position":23,"original_position":23,"commit_id":"e060db6385b8658d9d2d8e8456018e992c450f42","original_commit_id":"e060db6385b8658d9d2d8e8456018e992c450f42","user":{"login":"fsouza","id":108725,"avatar_url":"https://avatars.githubusercontent.com/u/108725?v=3","gravatar_id":"","url":"https://api.github.com/users/fsouza","html_url":"https://github.com/fsouza","followers_url":"https://api.github.com/users/fsouza/followers","following_url":"https://api.github.com/users/fsouza/following{/other_user}","gists_url":"https://api.github.com/users/fsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/fsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsouza/subscriptions","organizations_url":"https://api.github.com/users/fsouza/orgs","repos_url":"https://api.github.com/users/fsouza/repos","events_url":"https://api.github.com/users/fsouza/events{/privacy}","received_events_url":"https://api.github.com/users/fsouza/received_events","type":"User","site_admin":false},"body":"Since the gorilla returns nil when it's not defined, should this return nil as well?\r\n\r\nIt almost makes no difference for the caller (I wouldn't expect someone to modify the map returned by this function), but it could make the code here way simpler, something like:\r\n\r\n```\r\nrawVars := r.Context().Value(varsKey)\r\nvars, _ := rawVars.(map[string]string)\r\nreturn vars\r\n```","created_at":"2016-09-21T19:57:29Z","updated_at":"2016-09-21T19:59:11Z","html_url":"https://github.com/NYTimes/gizmo/pull/75#discussion_r79918984","pull_request_url":"https://api.github.com/repos/NYTimes/gizmo/pulls/75","_links":{"self":{"href":"https://api.github.com/repos/NYTimes/gizmo/pulls/comments/79918984"},"html":{"href":"https://github.com/NYTimes/gizmo/pull/75#discussion_r79918984"},"pull_request":{"href":"https://api.github.com/repos/NYTimes/gizmo/pulls/75"}}},"pull_request":{"url":"https://api.github.com/repos/NYTimes/gizmo/pulls/75","id":86228997,"html_url":"https://github.com/NYTimes/gizmo/pull/75","diff_url":"https://github.com/NYTimes/gizmo/pull/75.diff","patch_url":"https://github.com/NYTimes/gizmo/pull/75.patch","issue_url":"https://api.github.com/repos/NYTimes/gizmo/issues/75","number":75,"state":"open","locked":false,"title":"Fixing memory leak caused by routers in 1.7","user":{"login":"jprobinson","id":1386065,"avatar_url":"https://avatars.githubusercontent.com/u/1386065?v=3","gravatar_id":"","url":"https://api.github.com/users/jprobinson","html_url":"https://github.com/jprobinson","followers_url":"https://api.github.com/users/jprobinson/followers","following_url":"https://api.github.com/users/jprobinson/following{/other_user}","gists_url":"https://api.github.com/users/jprobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/jprobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jprobinson/subscriptions","organizations_url":"https://api.github.com/users/jprobinson/orgs","repos_url":"https://api.github.com/users/jprobinson/repos","events_url":"https://api.github.com/users/jprobinson/events{/privacy}","received_events_url":"https://api.github.com/users/jprobinson/received_events","type":"User","site_admin":false},"body":"This fix adds build tags around the `web.SetRouteVars` and `web.Vars` functions similar to the new tags in `gorilla/mux` for 1.7. The tags will use `gorilla/context` for <1.7 and the new native `context` package for 1.7.\r\n\r\nThis does introduce a small breaking change to `web.SetRouteVars` as it now requires you to use the `*http.Request` returned by that func, but after a quick github search I can see no one outside of gizmo (and other things I personally own) that will be affected.\r\n\r\nThis should fix issue #74.","created_at":"2016-09-21T19:47:27Z","updated_at":"2016-09-21T19:59:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a2031c64bde9c94e0fd1c85174a84b85b00aef7","assignee":{"login":"fsouza","id":108725,"avatar_url":"https://avatars.githubusercontent.com/u/108725?v=3","gravatar_id":"","url":"https://api.github.com/users/fsouza","html_url":"https://github.com/fsouza","followers_url":"https://api.github.com/users/fsouza/followers","following_url":"https://api.github.com/users/fsouza/following{/other_user}","gists_url":"https://api.github.com/users/fsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/fsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsouza/subscriptions","organizations_url":"https://api.github.com/users/fsouza/orgs","repos_url":"https://api.github.com/users/fsouza/repos","events_url":"https://api.github.com/users/fsouza/events{/privacy}","received_events_url":"https://api.github.com/users/fsouza/received_events","type":"User","site_admin":false},"assignees":[{"login":"fsouza","id":108725,"avatar_url":"https://avatars.githubusercontent.com/u/108725?v=3","gravatar_id":"","url":"https://api.github.com/users/fsouza","html_url":"https://github.com/fsouza","followers_url":"https://api.github.com/users/fsouza/followers","following_url":"https://api.github.com/users/fsouza/following{/other_user}","gists_url":"https://api.github.com/users/fsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/fsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsouza/subscriptions","organizations_url":"https://api.github.com/users/fsouza/orgs","repos_url":"https://api.github.com/users/fsouza/repos","events_url":"https://api.github.com/users/fsouza/events{/privacy}","received_events_url":"https://api.github.com/users/fsouza/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/NYTimes/gizmo/pulls/75/commits","review_comments_url":"https://api.github.com/repos/NYTimes/gizmo/pulls/75/comments","review_comment_url":"https://api.github.com/repos/NYTimes/gizmo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NYTimes/gizmo/issues/75/comments","statuses_url":"https://api.github.com/repos/NYTimes/gizmo/statuses/e060db6385b8658d9d2d8e8456018e992c450f42","head":{"label":"NYTimes:context","ref":"context","sha":"e060db6385b8658d9d2d8e8456018e992c450f42","user":{"login":"NYTimes","id":221409,"avatar_url":"https://avatars.githubusercontent.com/u/221409?v=3","gravatar_id":"","url":"https://api.github.com/users/NYTimes","html_url":"https://github.com/NYTimes","followers_url":"https://api.github.com/users/NYTimes/followers","following_url":"https://api.github.com/users/NYTimes/following{/other_user}","gists_url":"https://api.github.com/users/NYTimes/gists{/gist_id}","starred_url":"https://api.github.com/users/NYTimes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NYTimes/subscriptions","organizations_url":"https://api.github.com/users/NYTimes/orgs","repos_url":"https://api.github.com/users/NYTimes/repos","events_url":"https://api.github.com/users/NYTimes/events{/privacy}","received_events_url":"https://api.github.com/users/NYTimes/received_events","type":"Organization","site_admin":false},"repo":{"id":48060472,"name":"gizmo","full_name":"NYTimes/gizmo","owner":{"login":"NYTimes","id":221409,"avatar_url":"https://avatars.githubusercontent.com/u/221409?v=3","gravatar_id":"","url":"https://api.github.com/users/NYTimes","html_url":"https://github.com/NYTimes","followers_url":"https://api.github.com/users/NYTimes/followers","following_url":"https://api.github.com/users/NYTimes/following{/other_user}","gists_url":"https://api.github.com/users/NYTimes/gists{/gist_id}","starred_url":"https://api.github.com/users/NYTimes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NYTimes/subscriptions","organizations_url":"https://api.github.com/users/NYTimes/orgs","repos_url":"https://api.github.com/users/NYTimes/repos","events_url":"https://api.github.com/users/NYTimes/events{/privacy}","received_events_url":"https://api.github.com/users/NYTimes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NYTimes/gizmo","description":"A Microservice Toolkit from The New York Times","fork":false,"url":"https://api.github.com/repos/NYTimes/gizmo","forks_url":"https://api.github.com/repos/NYTimes/gizmo/forks","keys_url":"https://api.github.com/repos/NYTimes/gizmo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NYTimes/gizmo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NYTimes/gizmo/teams","hooks_url":"https://api.github.com/repos/NYTimes/gizmo/hooks","issue_events_url":"https://api.github.com/repos/NYTimes/gizmo/issues/events{/number}","events_url":"https://api.github.com/repos/NYTimes/gizmo/events","assignees_url":"https://api.github.com/repos/NYTimes/gizmo/assignees{/user}","branches_url":"https://api.github.com/repos/NYTimes/gizmo/branches{/branch}","tags_url":"https://api.github.com/repos/NYTimes/gizmo/tags","blobs_url":"https://api.github.com/repos/NYTimes/gizmo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NYTimes/gizmo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NYTimes/gizmo/git/refs{/sha}","trees_url":"https://api.github.com/repos/NYTimes/gizmo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NYTimes/gizmo/statuses/{sha}","languages_url":"https://api.github.com/repos/NYTimes/gizmo/languages","stargazers_url":"https://api.github.com/repos/NYTimes/gizmo/stargazers","contributors_url":"https://api.github.com/repos/NYTimes/gizmo/contributors","subscribers_url":"https://api.github.com/repos/NYTimes/gizmo/subscribers","subscription_url":"https://api.github.com/repos/NYTimes/gizmo/subscription","commits_url":"https://api.github.com/repos/NYTimes/gizmo/commits{/sha}","git_commits_url":"https://api.github.com/repos/NYTimes/gizmo/git/commits{/sha}","comments_url":"https://api.github.com/repos/NYTimes/gizmo/comments{/number}","issue_comment_url":"https://api.github.com/repos/NYTimes/gizmo/issues/comments{/number}","contents_url":"https://api.github.com/repos/NYTimes/gizmo/contents/{+path}","compare_url":"https://api.github.com/repos/NYTimes/gizmo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NYTimes/gizmo/merges","archive_url":"https://api.github.com/repos/NYTimes/gizmo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NYTimes/gizmo/downloads","issues_url":"https://api.github.com/repos/NYTimes/gizmo/issues{/number}","pulls_url":"https://api.github.com/repos/NYTimes/gizmo/pulls{/number}","milestones_url":"https://api.github.com/repos/NYTimes/gizmo/milestones{/number}","notifications_url":"https://api.github.com/repos/NYTimes/gizmo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NYTimes/gizmo/labels{/name}","releases_url":"https://api.github.com/repos/NYTimes/gizmo/releases{/id}","deployments_url":"https://api.github.com/repos/NYTimes/gizmo/deployments","created_at":"2015-12-15T18:09:36Z","updated_at":"2016-09-21T08:43:28Z","pushed_at":"2016-09-21T19:47:27Z","git_url":"git://github.com/NYTimes/gizmo.git","ssh_url":"git@github.com:NYTimes/gizmo.git","clone_url":"https://github.com/NYTimes/gizmo.git","svn_url":"https://github.com/NYTimes/gizmo","homepage":"http://open.blogs.nytimes.com/2015/12/17/introducing-gizmo/","size":425,"stargazers_count":1514,"watchers_count":1514,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":6,"forks":88,"open_issues":6,"watchers":1514,"default_branch":"master"}},"base":{"label":"NYTimes:master","ref":"master","sha":"57e99e177652cb34d1ca2fe531a054a6715332b1","user":{"login":"NYTimes","id":221409,"avatar_url":"https://avatars.githubusercontent.com/u/221409?v=3","gravatar_id":"","url":"https://api.github.com/users/NYTimes","html_url":"https://github.com/NYTimes","followers_url":"https://api.github.com/users/NYTimes/followers","following_url":"https://api.github.com/users/NYTimes/following{/other_user}","gists_url":"https://api.github.com/users/NYTimes/gists{/gist_id}","starred_url":"https://api.github.com/users/NYTimes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NYTimes/subscriptions","organizations_url":"https://api.github.com/users/NYTimes/orgs","repos_url":"https://api.github.com/users/NYTimes/repos","events_url":"https://api.github.com/users/NYTimes/events{/privacy}","received_events_url":"https://api.github.com/users/NYTimes/received_events","type":"Organization","site_admin":false},"repo":{"id":48060472,"name":"gizmo","full_name":"NYTimes/gizmo","owner":{"login":"NYTimes","id":221409,"avatar_url":"https://avatars.githubusercontent.com/u/221409?v=3","gravatar_id":"","url":"https://api.github.com/users/NYTimes","html_url":"https://github.com/NYTimes","followers_url":"https://api.github.com/users/NYTimes/followers","following_url":"https://api.github.com/users/NYTimes/following{/other_user}","gists_url":"https://api.github.com/users/NYTimes/gists{/gist_id}","starred_url":"https://api.github.com/users/NYTimes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NYTimes/subscriptions","organizations_url":"https://api.github.com/users/NYTimes/orgs","repos_url":"https://api.github.com/users/NYTimes/repos","events_url":"https://api.github.com/users/NYTimes/events{/privacy}","received_events_url":"https://api.github.com/users/NYTimes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NYTimes/gizmo","description":"A Microservice Toolkit from The New York Times","fork":false,"url":"https://api.github.com/repos/NYTimes/gizmo","forks_url":"https://api.github.com/repos/NYTimes/gizmo/forks","keys_url":"https://api.github.com/repos/NYTimes/gizmo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NYTimes/gizmo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NYTimes/gizmo/teams","hooks_url":"https://api.github.com/repos/NYTimes/gizmo/hooks","issue_events_url":"https://api.github.com/repos/NYTimes/gizmo/issues/events{/number}","events_url":"https://api.github.com/repos/NYTimes/gizmo/events","assignees_url":"https://api.github.com/repos/NYTimes/gizmo/assignees{/user}","branches_url":"https://api.github.com/repos/NYTimes/gizmo/branches{/branch}","tags_url":"https://api.github.com/repos/NYTimes/gizmo/tags","blobs_url":"https://api.github.com/repos/NYTimes/gizmo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NYTimes/gizmo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NYTimes/gizmo/git/refs{/sha}","trees_url":"https://api.github.com/repos/NYTimes/gizmo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NYTimes/gizmo/statuses/{sha}","languages_url":"https://api.github.com/repos/NYTimes/gizmo/languages","stargazers_url":"https://api.github.com/repos/NYTimes/gizmo/stargazers","contributors_url":"https://api.github.com/repos/NYTimes/gizmo/contributors","subscribers_url":"https://api.github.com/repos/NYTimes/gizmo/subscribers","subscription_url":"https://api.github.com/repos/NYTimes/gizmo/subscription","commits_url":"https://api.github.com/repos/NYTimes/gizmo/commits{/sha}","git_commits_url":"https://api.github.com/repos/NYTimes/gizmo/git/commits{/sha}","comments_url":"https://api.github.com/repos/NYTimes/gizmo/comments{/number}","issue_comment_url":"https://api.github.com/repos/NYTimes/gizmo/issues/comments{/number}","contents_url":"https://api.github.com/repos/NYTimes/gizmo/contents/{+path}","compare_url":"https://api.github.com/repos/NYTimes/gizmo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NYTimes/gizmo/merges","archive_url":"https://api.github.com/repos/NYTimes/gizmo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NYTimes/gizmo/downloads","issues_url":"https://api.github.com/repos/NYTimes/gizmo/issues{/number}","pulls_url":"https://api.github.com/repos/NYTimes/gizmo/pulls{/number}","milestones_url":"https://api.github.com/repos/NYTimes/gizmo/milestones{/number}","notifications_url":"https://api.github.com/repos/NYTimes/gizmo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NYTimes/gizmo/labels{/name}","releases_url":"https://api.github.com/repos/NYTimes/gizmo/releases{/id}","deployments_url":"https://api.github.com/repos/NYTimes/gizmo/deployments","created_at":"2015-12-15T18:09:36Z","updated_at":"2016-09-21T08:43:28Z","pushed_at":"2016-09-21T19:47:27Z","git_url":"git://github.com/NYTimes/gizmo.git","ssh_url":"git@github.com:NYTimes/gizmo.git","clone_url":"https://github.com/NYTimes/gizmo.git","svn_url":"https://github.com/NYTimes/gizmo","homepage":"http://open.blogs.nytimes.com/2015/12/17/introducing-gizmo/","size":425,"stargazers_count":1514,"watchers_count":1514,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":6,"forks":88,"open_issues":6,"watchers":1514,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NYTimes/gizmo/pulls/75"},"html":{"href":"https://github.com/NYTimes/gizmo/pull/75"},"issue":{"href":"https://api.github.com/repos/NYTimes/gizmo/issues/75"},"comments":{"href":"https://api.github.com/repos/NYTimes/gizmo/issues/75/comments"},"review_comments":{"href":"https://api.github.com/repos/NYTimes/gizmo/pulls/75/comments"},"review_comment":{"href":"https://api.github.com/repos/NYTimes/gizmo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NYTimes/gizmo/pulls/75/commits"},"statuses":{"href":"https://api.github.com/repos/NYTimes/gizmo/statuses/e060db6385b8658d9d2d8e8456018e992c450f42"}}}}
{"actor":{"display_login":"fsouza"}}