{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/plek/pulls/comments/25590157","id":25590157,"diff_hunk":"@@ -77,53 +73,47 @@ func New(parentDomain string) Plek {\n }\n \n // Find returns the base URL for the given service name.\n-func (p Plek) Find(serviceName string) *url.URL {\n+func (p Plek) Find(serviceName string) string {\n \tu := &url.URL{Scheme: \"https\", Host: serviceName + \".\" + p.parentDomain}\n \tif httpDomains[p.parentDomain] {\n \t\tu.Scheme = \"http\"\n \t}\n-\treturn u\n+\treturn u.String()\n }\n \n // WebsiteRoot returns the public website base URL.  This is taken from the\n // GOVUK_WEBSITE_ROOT environment variable.  If this is unset, an EnvVarMissing\n-// error will be returned.  If it can't be parsed by url.Parse, an\n-// EnvVarURLInvalid error will be returned.\n-func WebsiteRoot() (*url.URL, error) {\n-\treturn parseEnvVarURL(\"GOVUK_WEBSITE_ROOT\")\n+// error will be returned.\n+func WebsiteRoot() (string, error) {\n+\treturn readEnvVarURL(\"GOVUK_WEBSITE_ROOT\")\n }\n \n // AssetRoot returns the public assets base URL. This is taken from the\n // GOVUK_ASSET_ROOT environment variable.  If this is unset, an EnvVarMissing\n-// error will be returned.  If it can't be parsed by url.Parse, an\n-// EnvVarURLInvalid error will be returned.\n-func AssetRoot() (*url.URL, error) {\n-\treturn parseEnvVarURL(\"GOVUK_ASSET_ROOT\")\n+// error will be returned.\n+func AssetRoot() (string, error) {\n+\treturn readEnvVarURL(\"GOVUK_ASSET_ROOT\")\n }\n \n-func parseEnvVarURL(envVar string) (*url.URL, error) {\n+func readEnvVarURL(envVar string) (string, error) {\n \turlString := os.Getenv(envVar)\n \tif urlString == \"\" {\n-\t\treturn nil, &EnvVarMissing{EnvVar: envVar}\n-\t}\n-\tu, err := url.Parse(urlString)\n-\tif err != nil {\n-\t\treturn nil, &EnvVarURLInvalid{EnvVar: envVar, Err: err}\n+\t\treturn \"\", &EnvVarMissing{EnvVar: envVar}\n \t}\n-\treturn u, nil\n+\treturn urlString, nil\n }\n \n-func serviceURLFromEnvOverride(serviceName string) (*url.URL, error) {\n+func serviceURLFromEnvOverride(serviceName string) string {\n \tvarName := fmt.Sprintf(\n \t\t\"PLEK_SERVICE_%s_URI\",\n \t\tstrings.ToUpper(strings.Replace(serviceName, \"-\", \"_\", -1)),\n \t)\n-\turl, err := parseEnvVarURL(varName)\n+\turlString, err := readEnvVarURL(varName)\n \tif err != nil {\n \t\tif _, ok := err.(*EnvVarMissing); ok {\n-\t\t\treturn nil, nil\n+\t\t\treturn \"\"\n \t\t}","path":"go/plek.go","position":82,"original_position":82,"commit_id":"2c54b284176ab15b2111823f2f73d1dac57ceced","original_commit_id":"2c54b284176ab15b2111823f2f73d1dac57ceced","user":{"login":"alext","id":5560,"avatar_url":"https://avatars.githubusercontent.com/u/5560?v=3","gravatar_id":"","url":"https://api.github.com/users/alext","html_url":"https://github.com/alext","followers_url":"https://api.github.com/users/alext/followers","following_url":"https://api.github.com/users/alext/following{/other_user}","gists_url":"https://api.github.com/users/alext/gists{/gist_id}","starred_url":"https://api.github.com/users/alext/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alext/subscriptions","organizations_url":"https://api.github.com/users/alext/orgs","repos_url":"https://api.github.com/users/alext/repos","events_url":"https://api.github.com/users/alext/events{/privacy}","received_events_url":"https://api.github.com/users/alext/received_events","type":"User","site_admin":false},"body":"This conditional is now redundant...  Might be worth replacing with a comment clarifying that the only error that can be returned here is an `EnvVarMissing`.","created_at":"2015-03-02T10:52:22Z","updated_at":"2015-03-02T10:52:22Z","html_url":"https://github.com/alphagov/plek/pull/31#discussion_r25590157","pull_request_url":"https://api.github.com/repos/alphagov/plek/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/alphagov/plek/pulls/comments/25590157"},"html":{"href":"https://github.com/alphagov/plek/pull/31#discussion_r25590157"},"pull_request":{"href":"https://api.github.com/repos/alphagov/plek/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/plek/pulls/31","id":30272362,"html_url":"https://github.com/alphagov/plek/pull/31","diff_url":"https://github.com/alphagov/plek/pull/31.diff","patch_url":"https://github.com/alphagov/plek/pull/31.patch","issue_url":"https://api.github.com/repos/alphagov/plek/issues/31","number":31,"state":"open","locked":false,"title":"Return url strings in response to `plek.Find`","user":{"login":"vinayvinay","id":230074,"avatar_url":"https://avatars.githubusercontent.com/u/230074?v=3","gravatar_id":"","url":"https://api.github.com/users/vinayvinay","html_url":"https://github.com/vinayvinay","followers_url":"https://api.github.com/users/vinayvinay/followers","following_url":"https://api.github.com/users/vinayvinay/following{/other_user}","gists_url":"https://api.github.com/users/vinayvinay/gists{/gist_id}","starred_url":"https://api.github.com/users/vinayvinay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinayvinay/subscriptions","organizations_url":"https://api.github.com/users/vinayvinay/orgs","repos_url":"https://api.github.com/users/vinayvinay/repos","events_url":"https://api.github.com/users/vinayvinay/events{/privacy}","received_events_url":"https://api.github.com/users/vinayvinay/received_events","type":"User","site_admin":false},"body":"outcome of a [discussion](https://github.com/alphagov/publishing-api/pull/29#discussion-diff-25501083) on another PR.\r\n\r\npublishing-api, one of the first consuming apps of plek.go, finds it easier to work with string URLs returned from plek, and doesn't have a need for `URL` objects to be returned.\r\n\r\nbuild failure's unrelated, ci-slave-2.internal has no space left.","created_at":"2015-03-02T10:29:15Z","updated_at":"2015-03-02T10:52:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cae87b7db83027bf65e652ffaa04e465b1681779","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/plek/pulls/31/commits","review_comments_url":"https://api.github.com/repos/alphagov/plek/pulls/31/comments","review_comment_url":"https://api.github.com/repos/alphagov/plek/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/plek/issues/31/comments","statuses_url":"https://api.github.com/repos/alphagov/plek/statuses/2c54b284176ab15b2111823f2f73d1dac57ceced","head":{"label":"alphagov:return-strings-from-plek-go","ref":"return-strings-from-plek-go","sha":"2c54b284176ab15b2111823f2f73d1dac57ceced","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2415825,"name":"plek","full_name":"alphagov/plek","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/plek","description":"Service location arbiter","fork":false,"url":"https://api.github.com/repos/alphagov/plek","forks_url":"https://api.github.com/repos/alphagov/plek/forks","keys_url":"https://api.github.com/repos/alphagov/plek/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/plek/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/plek/teams","hooks_url":"https://api.github.com/repos/alphagov/plek/hooks","issue_events_url":"https://api.github.com/repos/alphagov/plek/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/plek/events","assignees_url":"https://api.github.com/repos/alphagov/plek/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/plek/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/plek/tags","blobs_url":"https://api.github.com/repos/alphagov/plek/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/plek/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/plek/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/plek/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/plek/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/plek/languages","stargazers_url":"https://api.github.com/repos/alphagov/plek/stargazers","contributors_url":"https://api.github.com/repos/alphagov/plek/contributors","subscribers_url":"https://api.github.com/repos/alphagov/plek/subscribers","subscription_url":"https://api.github.com/repos/alphagov/plek/subscription","commits_url":"https://api.github.com/repos/alphagov/plek/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/plek/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/plek/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/plek/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/plek/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/plek/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/plek/merges","archive_url":"https://api.github.com/repos/alphagov/plek/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/plek/downloads","issues_url":"https://api.github.com/repos/alphagov/plek/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/plek/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/plek/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/plek/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/plek/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/plek/releases{/id}","created_at":"2011-09-19T14:31:37Z","updated_at":"2015-02-27T11:23:20Z","pushed_at":"2015-03-02T10:43:15Z","git_url":"git://github.com/alphagov/plek.git","ssh_url":"git@github.com:alphagov/plek.git","clone_url":"https://github.com/alphagov/plek.git","svn_url":"https://github.com/alphagov/plek","homepage":"","size":602,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"24aeac69d5b8998ea6d982736e0017aa0ece97a9","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2415825,"name":"plek","full_name":"alphagov/plek","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/plek","description":"Service location arbiter","fork":false,"url":"https://api.github.com/repos/alphagov/plek","forks_url":"https://api.github.com/repos/alphagov/plek/forks","keys_url":"https://api.github.com/repos/alphagov/plek/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/plek/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/plek/teams","hooks_url":"https://api.github.com/repos/alphagov/plek/hooks","issue_events_url":"https://api.github.com/repos/alphagov/plek/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/plek/events","assignees_url":"https://api.github.com/repos/alphagov/plek/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/plek/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/plek/tags","blobs_url":"https://api.github.com/repos/alphagov/plek/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/plek/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/plek/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/plek/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/plek/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/plek/languages","stargazers_url":"https://api.github.com/repos/alphagov/plek/stargazers","contributors_url":"https://api.github.com/repos/alphagov/plek/contributors","subscribers_url":"https://api.github.com/repos/alphagov/plek/subscribers","subscription_url":"https://api.github.com/repos/alphagov/plek/subscription","commits_url":"https://api.github.com/repos/alphagov/plek/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/plek/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/plek/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/plek/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/plek/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/plek/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/plek/merges","archive_url":"https://api.github.com/repos/alphagov/plek/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/plek/downloads","issues_url":"https://api.github.com/repos/alphagov/plek/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/plek/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/plek/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/plek/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/plek/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/plek/releases{/id}","created_at":"2011-09-19T14:31:37Z","updated_at":"2015-02-27T11:23:20Z","pushed_at":"2015-03-02T10:43:15Z","git_url":"git://github.com/alphagov/plek.git","ssh_url":"git@github.com:alphagov/plek.git","clone_url":"https://github.com/alphagov/plek.git","svn_url":"https://github.com/alphagov/plek","homepage":"","size":602,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/plek/pulls/31"},"html":{"href":"https://github.com/alphagov/plek/pull/31"},"issue":{"href":"https://api.github.com/repos/alphagov/plek/issues/31"},"comments":{"href":"https://api.github.com/repos/alphagov/plek/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/plek/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/plek/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/plek/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/plek/statuses/2c54b284176ab15b2111823f2f73d1dac57ceced"}}}}