{"action":"created","issue":{"url":"https://api.github.com/repos/runcom/rhel-push-plugin/issues/2","repository_url":"https://api.github.com/repos/runcom/rhel-push-plugin","labels_url":"https://api.github.com/repos/runcom/rhel-push-plugin/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/runcom/rhel-push-plugin/issues/2/comments","events_url":"https://api.github.com/repos/runcom/rhel-push-plugin/issues/2/events","html_url":"https://github.com/runcom/rhel-push-plugin/issues/2","id":138997719,"number":2,"title":"Suspicious logic in ref.Hostname() == \"docker.io\" case","user":{"login":"mtrmac","id":7052838,"avatar_url":"https://avatars.githubusercontent.com/u/7052838?v=3","gravatar_id":"","url":"https://api.github.com/users/mtrmac","html_url":"https://github.com/mtrmac","followers_url":"https://api.github.com/users/mtrmac/followers","following_url":"https://api.github.com/users/mtrmac/following{/other_user}","gists_url":"https://api.github.com/users/mtrmac/gists{/gist_id}","starred_url":"https://api.github.com/users/mtrmac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtrmac/subscriptions","organizations_url":"https://api.github.com/users/mtrmac/orgs","repos_url":"https://api.github.com/users/mtrmac/repos","events_url":"https://api.github.com/users/mtrmac/events{/privacy}","received_events_url":"https://api.github.com/users/mtrmac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-07T14:52:51Z","updated_at":"2016-03-07T15:02:29Z","closed_at":null,"body":"https://github.com/runcom/rhel-push-plugin/blob/master/plugin.go#L86:\r\n```\r\n\t\t\tif len(registries) != 0 {\r\n\t\t\t\tif registries[0] == \"docker.io\" {\r\n\t\t\t\t\tgoto noallow\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tgoto noallow\r\n```\r\n\r\n- The `if` sequence appears redundant.\r\n- (Assuming that the `if` is necessary:) Why is `registries[0]` special and others can be ignored? This should have at least a comment.\r\n\r\n(Also, why both `strings.HasPrefix` and the `ref.Hostname` check? I may be naive but it seems there should be a single definite way to get the docker registry identity that will be used for a particular name.)"},"comment":{"url":"https://api.github.com/repos/runcom/rhel-push-plugin/issues/comments/193286148","html_url":"https://github.com/runcom/rhel-push-plugin/issues/2#issuecomment-193286148","issue_url":"https://api.github.com/repos/runcom/rhel-push-plugin/issues/2","id":193286148,"user":{"login":"runcom","id":849915,"avatar_url":"https://avatars.githubusercontent.com/u/849915?v=3","gravatar_id":"","url":"https://api.github.com/users/runcom","html_url":"https://github.com/runcom","followers_url":"https://api.github.com/users/runcom/followers","following_url":"https://api.github.com/users/runcom/following{/other_user}","gists_url":"https://api.github.com/users/runcom/gists{/gist_id}","starred_url":"https://api.github.com/users/runcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runcom/subscriptions","organizations_url":"https://api.github.com/users/runcom/orgs","repos_url":"https://api.github.com/users/runcom/repos","events_url":"https://api.github.com/users/runcom/events{/privacy}","received_events_url":"https://api.github.com/users/runcom/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T15:02:29Z","updated_at":"2016-03-07T15:02:29Z","body":"ref.Hostname() == \"docker.io\" is also needed because after the ref parse it gets appended automatically if no hostname is provided with the image"}}