{"action":"created","comment":{"url":"https://api.github.com/repos/uber-go/config/pulls/comments/194588581","pull_request_review_id":127789245,"id":194588581,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDU4ODU4MQ==","diff_hunk":"@@ -22,16 +22,64 @@ package config\n \n import (\n \t\"bytes\"\n+\t\"fmt\"\n+\t\"strings\"\n \n \t\"golang.org/x/text/transform\"\n )\n \n+const (\n+\t_envSeparator = \":\"\n+\t_emptyDefault = `\"\"`\n+)\n+\n+// A LookupFunc behaves like os.LookupEnv: it uses the supplied string as a\n+// key into some key-value store and returns the value and whether the key was\n+// present.\n+type LookupFunc = func(string) (string, bool)\n+\n+// Given a function with the same signature as os.LookupEnv, return a function\n+// that expands expressions of the form ${ENV_VAR:default_value}.\n+func replace(lookUp LookupFunc) func(in string) (string, error) {\n+\treturn func(in string) (string, error) {\n+\t\tsep := strings.Index(in, _envSeparator)\n+\t\tvar key string\n+\t\tvar def string\n+\n+\t\tif sep == -1 {\n+\t\t\t// separator missing - everything is the key ${KEY}\n+\t\t\tkey = in\n+\t\t} else {\n+\t\t\t// ${KEY:DEFAULT}\n+\t\t\tkey = in[:sep]\n+\t\t\tdef = in[sep+1:]\n+\t\t}\n+\n+\t\tif envVal, ok := lookUp(key); ok {\n+\t\t\treturn envVal, nil\n+\t\t}\n+\n+\t\tif def == \"\" {\n+\t\t\treturn \"\", fmt.Errorf(`default is empty for %q (use \"\" for empty string)`, key)","path":"expand.go","position":48,"original_position":48,"commit_id":"3e286203a407494db8dc49bf41c5d208e3d4b174","original_commit_id":"4a3d2c351939120a9d002e201ecd919fe5dbd6b8","user":{"login":"amckinney","id":5760684,"node_id":"MDQ6VXNlcjU3NjA2ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5760684?v=4","gravatar_id":"","url":"https://api.github.com/users/amckinney","html_url":"https://github.com/amckinney","followers_url":"https://api.github.com/users/amckinney/followers","following_url":"https://api.github.com/users/amckinney/following{/other_user}","gists_url":"https://api.github.com/users/amckinney/gists{/gist_id}","starred_url":"https://api.github.com/users/amckinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amckinney/subscriptions","organizations_url":"https://api.github.com/users/amckinney/orgs","repos_url":"https://api.github.com/users/amckinney/repos","events_url":"https://api.github.com/users/amckinney/events{/privacy}","received_events_url":"https://api.github.com/users/amckinney/received_events","type":"User","site_admin":false},"body":"Sounds good!","created_at":"2018-06-12T00:50:08Z","updated_at":"2018-06-12T00:50:08Z","html_url":"https://github.com/uber-go/config/pull/87#discussion_r194588581","pull_request_url":"https://api.github.com/repos/uber-go/config/pulls/87","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/uber-go/config/pulls/comments/194588581"},"html":{"href":"https://github.com/uber-go/config/pull/87#discussion_r194588581"},"pull_request":{"href":"https://api.github.com/repos/uber-go/config/pulls/87"}},"in_reply_to_id":193599272},"pull_request":{"url":"https://api.github.com/repos/uber-go/config/pulls/87","id":192865096,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyODY1MDk2","html_url":"https://github.com/uber-go/config/pull/87","diff_url":"https://github.com/uber-go/config/pull/87.diff","patch_url":"https://github.com/uber-go/config/pull/87.patch","issue_url":"https://api.github.com/repos/uber-go/config/issues/87","number":87,"state":"open","locked":false,"title":"Replace provider and value implementations","user":{"login":"akshayjshah","id":972790,"node_id":"MDQ6VXNlcjk3Mjc5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/972790?v=4","gravatar_id":"","url":"https://api.github.com/users/akshayjshah","html_url":"https://github.com/akshayjshah","followers_url":"https://api.github.com/users/akshayjshah/followers","following_url":"https://api.github.com/users/akshayjshah/following{/other_user}","gists_url":"https://api.github.com/users/akshayjshah/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayjshah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayjshah/subscriptions","organizations_url":"https://api.github.com/users/akshayjshah/orgs","repos_url":"https://api.github.com/users/akshayjshah/repos","events_url":"https://api.github.com/users/akshayjshah/events{/privacy}","received_events_url":"https://api.github.com/users/akshayjshah/received_events","type":"User","site_admin":false},"body":"With the foundation laid by an integration test suite and the internal\r\nYAML-merging package, gut the internals of this package and reimplement\r\nthe core types.\r\n\r\nThe new implementation is intentionally naive: since we're only using\r\nthis package at process startup, we don't care much about performance\r\nand can afford repeated round-trips through YAML. This has two benefits:\r\nthe code is simpler, and it's easier to leverage all the features that\r\n`gopkg.in/yaml.v2` already has (especially strict unmarshalling mode).\r\nWhile we have the opportunity, we also introduce a new constructor that\r\ntakes functional options. I've also improved the GoDoc and deprecated a\r\nbunch of the existing APIs (though they all continue to function as\r\nexpected).\r\n\r\nThis fixes issues #57, #59, #72, #73, #75, #76, #80, and a pile of other\r\nbugs that weren't reported by users.","created_at":"2018-06-05T23:42:24Z","updated_at":"2018-06-12T00:50:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68830f8afaa89f0cc3c2d95c14d0171aefb8d787","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uber-go/config/pulls/87/commits","review_comments_url":"https://api.github.com/repos/uber-go/config/pulls/87/comments","review_comment_url":"https://api.github.com/repos/uber-go/config/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber-go/config/issues/87/comments","statuses_url":"https://api.github.com/repos/uber-go/config/statuses/3e286203a407494db8dc49bf41c5d208e3d4b174","head":{"label":"uber-go:ajs/merge","ref":"ajs/merge","sha":"3e286203a407494db8dc49bf41c5d208e3d4b174","user":{"login":"uber-go","id":19262598,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjYyNTk4","avatar_url":"https://avatars2.githubusercontent.com/u/19262598?v=4","gravatar_id":"","url":"https://api.github.com/users/uber-go","html_url":"https://github.com/uber-go","followers_url":"https://api.github.com/users/uber-go/followers","following_url":"https://api.github.com/users/uber-go/following{/other_user}","gists_url":"https://api.github.com/users/uber-go/gists{/gist_id}","starred_url":"https://api.github.com/users/uber-go/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber-go/subscriptions","organizations_url":"https://api.github.com/users/uber-go/orgs","repos_url":"https://api.github.com/users/uber-go/repos","events_url":"https://api.github.com/users/uber-go/events{/privacy}","received_events_url":"https://api.github.com/users/uber-go/received_events","type":"Organization","site_admin":false},"repo":{"id":92202364,"node_id":"MDEwOlJlcG9zaXRvcnk5MjIwMjM2NA==","name":"config","full_name":"uber-go/config","owner":{"login":"uber-go","id":19262598,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjYyNTk4","avatar_url":"https://avatars2.githubusercontent.com/u/19262598?v=4","gravatar_id":"","url":"https://api.github.com/users/uber-go","html_url":"https://github.com/uber-go","followers_url":"https://api.github.com/users/uber-go/followers","following_url":"https://api.github.com/users/uber-go/following{/other_user}","gists_url":"https://api.github.com/users/uber-go/gists{/gist_id}","starred_url":"https://api.github.com/users/uber-go/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber-go/subscriptions","organizations_url":"https://api.github.com/users/uber-go/orgs","repos_url":"https://api.github.com/users/uber-go/repos","events_url":"https://api.github.com/users/uber-go/events{/privacy}","received_events_url":"https://api.github.com/users/uber-go/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber-go/config","description":"Configuration for Go applications","fork":false,"url":"https://api.github.com/repos/uber-go/config","forks_url":"https://api.github.com/repos/uber-go/config/forks","keys_url":"https://api.github.com/repos/uber-go/config/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber-go/config/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber-go/config/teams","hooks_url":"https://api.github.com/repos/uber-go/config/hooks","issue_events_url":"https://api.github.com/repos/uber-go/config/issues/events{/number}","events_url":"https://api.github.com/repos/uber-go/config/events","assignees_url":"https://api.github.com/repos/uber-go/config/assignees{/user}","branches_url":"https://api.github.com/repos/uber-go/config/branches{/branch}","tags_url":"https://api.github.com/repos/uber-go/config/tags","blobs_url":"https://api.github.com/repos/uber-go/config/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber-go/config/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber-go/config/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber-go/config/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber-go/config/statuses/{sha}","languages_url":"https://api.github.com/repos/uber-go/config/languages","stargazers_url":"https://api.github.com/repos/uber-go/config/stargazers","contributors_url":"https://api.github.com/repos/uber-go/config/contributors","subscribers_url":"https://api.github.com/repos/uber-go/config/subscribers","subscription_url":"https://api.github.com/repos/uber-go/config/subscription","commits_url":"https://api.github.com/repos/uber-go/config/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber-go/config/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber-go/config/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber-go/config/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber-go/config/contents/{+path}","compare_url":"https://api.github.com/repos/uber-go/config/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber-go/config/merges","archive_url":"https://api.github.com/repos/uber-go/config/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber-go/config/downloads","issues_url":"https://api.github.com/repos/uber-go/config/issues{/number}","pulls_url":"https://api.github.com/repos/uber-go/config/pulls{/number}","milestones_url":"https://api.github.com/repos/uber-go/config/milestones{/number}","notifications_url":"https://api.github.com/repos/uber-go/config/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber-go/config/labels{/name}","releases_url":"https://api.github.com/repos/uber-go/config/releases{/id}","deployments_url":"https://api.github.com/repos/uber-go/config/deployments","created_at":"2017-05-23T17:45:52Z","updated_at":"2018-06-08T16:31:51Z","pushed_at":"2018-06-08T05:15:31Z","git_url":"git://github.com/uber-go/config.git","ssh_url":"git@github.com:uber-go/config.git","clone_url":"https://github.com/uber-go/config.git","svn_url":"https://github.com/uber-go/config","homepage":"https://godoc.org/go.uber.org/config","size":271,"stargazers_count":50,"watchers_count":50,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":11,"watchers":50,"default_branch":"master"}},"base":{"label":"uber-go:master","ref":"master","sha":"ba07836a6416a9edb53502854afdc9ef5ebc16ec","user":{"login":"uber-go","id":19262598,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjYyNTk4","avatar_url":"https://avatars2.githubusercontent.com/u/19262598?v=4","gravatar_id":"","url":"https://api.github.com/users/uber-go","html_url":"https://github.com/uber-go","followers_url":"https://api.github.com/users/uber-go/followers","following_url":"https://api.github.com/users/uber-go/following{/other_user}","gists_url":"https://api.github.com/users/uber-go/gists{/gist_id}","starred_url":"https://api.github.com/users/uber-go/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber-go/subscriptions","organizations_url":"https://api.github.com/users/uber-go/orgs","repos_url":"https://api.github.com/users/uber-go/repos","events_url":"https://api.github.com/users/uber-go/events{/privacy}","received_events_url":"https://api.github.com/users/uber-go/received_events","type":"Organization","site_admin":false},"repo":{"id":92202364,"node_id":"MDEwOlJlcG9zaXRvcnk5MjIwMjM2NA==","name":"config","full_name":"uber-go/config","owner":{"login":"uber-go","id":19262598,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjYyNTk4","avatar_url":"https://avatars2.githubusercontent.com/u/19262598?v=4","gravatar_id":"","url":"https://api.github.com/users/uber-go","html_url":"https://github.com/uber-go","followers_url":"https://api.github.com/users/uber-go/followers","following_url":"https://api.github.com/users/uber-go/following{/other_user}","gists_url":"https://api.github.com/users/uber-go/gists{/gist_id}","starred_url":"https://api.github.com/users/uber-go/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber-go/subscriptions","organizations_url":"https://api.github.com/users/uber-go/orgs","repos_url":"https://api.github.com/users/uber-go/repos","events_url":"https://api.github.com/users/uber-go/events{/privacy}","received_events_url":"https://api.github.com/users/uber-go/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber-go/config","description":"Configuration for Go applications","fork":false,"url":"https://api.github.com/repos/uber-go/config","forks_url":"https://api.github.com/repos/uber-go/config/forks","keys_url":"https://api.github.com/repos/uber-go/config/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber-go/config/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber-go/config/teams","hooks_url":"https://api.github.com/repos/uber-go/config/hooks","issue_events_url":"https://api.github.com/repos/uber-go/config/issues/events{/number}","events_url":"https://api.github.com/repos/uber-go/config/events","assignees_url":"https://api.github.com/repos/uber-go/config/assignees{/user}","branches_url":"https://api.github.com/repos/uber-go/config/branches{/branch}","tags_url":"https://api.github.com/repos/uber-go/config/tags","blobs_url":"https://api.github.com/repos/uber-go/config/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber-go/config/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber-go/config/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber-go/config/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber-go/config/statuses/{sha}","languages_url":"https://api.github.com/repos/uber-go/config/languages","stargazers_url":"https://api.github.com/repos/uber-go/config/stargazers","contributors_url":"https://api.github.com/repos/uber-go/config/contributors","subscribers_url":"https://api.github.com/repos/uber-go/config/subscribers","subscription_url":"https://api.github.com/repos/uber-go/config/subscription","commits_url":"https://api.github.com/repos/uber-go/config/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber-go/config/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber-go/config/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber-go/config/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber-go/config/contents/{+path}","compare_url":"https://api.github.com/repos/uber-go/config/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber-go/config/merges","archive_url":"https://api.github.com/repos/uber-go/config/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber-go/config/downloads","issues_url":"https://api.github.com/repos/uber-go/config/issues{/number}","pulls_url":"https://api.github.com/repos/uber-go/config/pulls{/number}","milestones_url":"https://api.github.com/repos/uber-go/config/milestones{/number}","notifications_url":"https://api.github.com/repos/uber-go/config/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber-go/config/labels{/name}","releases_url":"https://api.github.com/repos/uber-go/config/releases{/id}","deployments_url":"https://api.github.com/repos/uber-go/config/deployments","created_at":"2017-05-23T17:45:52Z","updated_at":"2018-06-08T16:31:51Z","pushed_at":"2018-06-08T05:15:31Z","git_url":"git://github.com/uber-go/config.git","ssh_url":"git@github.com:uber-go/config.git","clone_url":"https://github.com/uber-go/config.git","svn_url":"https://github.com/uber-go/config","homepage":"https://godoc.org/go.uber.org/config","size":271,"stargazers_count":50,"watchers_count":50,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":11,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber-go/config/pulls/87"},"html":{"href":"https://github.com/uber-go/config/pull/87"},"issue":{"href":"https://api.github.com/repos/uber-go/config/issues/87"},"comments":{"href":"https://api.github.com/repos/uber-go/config/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/uber-go/config/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/uber-go/config/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber-go/config/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/uber-go/config/statuses/3e286203a407494db8dc49bf41c5d208e3d4b174"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"amckinney"}}