{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/comments/32206118","id":32206118,"diff_hunk":"@@ -375,37 +401,47 @@ func (rg *RecordGenerator) setFromLocal(host string, ns string) {\n \t}\n }\n \n-// insertRR inserts host to name's map\n-// REFACTOR when storage is updated\n-func (rg *RecordGenerator) insertRR(name string, host string, rtype string) {\n-\tlogging.VeryVerbose.Println(\"[\" + rtype + \"]\\t\" + name + \": \" + host)\n-\n+func (rg *RecordGenerator) exists(name string, host string, rtype string) bool {\n \tif rtype == \"A\" {\n \t\tif val, ok := rg.As[name]; ok {\n \t\t\t// check if A record already exists\n \t\t\t// identical tasks on same slave\n \t\t\tfor _, b := range val {\n \t\t\t\tif b == host {\n-\t\t\t\t\treturn\n+\t\t\t\t\treturn true\n \t\t\t\t}\n \t\t\t}\n-\t\t\trg.As[name] = append(val, host)\n-\t\t} else {\n-\t\t\trg.As[name] = []string{host}\n \t\t}\n \t} else {\n \t\tif val, ok := rg.SRVs[name]; ok {\n \t\t\t// check if SRV record already exists\n \t\t\tfor _, b := range val {\n \t\t\t\tif b == host {\n-\t\t\t\t\treturn\n+\t\t\t\t\treturn true\n \t\t\t\t}\n \t\t\t}\n-\t\t\trg.SRVs[name] = append(val, host)\n-\t\t} else {\n-\t\t\trg.SRVs[name] = []string{host}\n \t\t}\n \t}\n+\treturn false\n+}\n+\n+// insertRR adds a record to the appropriate record map for the given name/host pair,\n+// but only if the pair is unique. returns true if added, false otherwise.\n+// TODO(???): REFACTOR when storage is updated\n+func (rg *RecordGenerator) insertRR(name string, host string, rtype string) bool {","path":"records/generator.go","position":125,"original_position":125,"commit_id":"3fe4b415c0f0d717e8686b6efff31337e39e33ad","original_commit_id":"3fe4b415c0f0d717e8686b6efff31337e39e33ad","user":{"login":"tsenart","id":67471,"avatar_url":"https://avatars.githubusercontent.com/u/67471?v=3","gravatar_id":"","url":"https://api.github.com/users/tsenart","html_url":"https://github.com/tsenart","followers_url":"https://api.github.com/users/tsenart/followers","following_url":"https://api.github.com/users/tsenart/following{/other_user}","gists_url":"https://api.github.com/users/tsenart/gists{/gist_id}","starred_url":"https://api.github.com/users/tsenart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsenart/subscriptions","organizations_url":"https://api.github.com/users/tsenart/orgs","repos_url":"https://api.github.com/users/tsenart/repos","events_url":"https://api.github.com/users/tsenart/events{/privacy}","received_events_url":"https://api.github.com/users/tsenart/received_events","type":"User","site_admin":false},"body":"Argument types can be coalesced.\r\n```go\r\nfunc (rg *RecordGenerator) insertRR(name, host, rtype string) bool {\r\n```","created_at":"2015-06-11T10:01:31Z","updated_at":"2015-06-11T10:01:31Z","html_url":"https://github.com/mesosphere/mesos-dns/pull/169#discussion_r32206118","pull_request_url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/comments/32206118"},"html":{"href":"https://github.com/mesosphere/mesos-dns/pull/169#discussion_r32206118"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169","id":37428079,"html_url":"https://github.com/mesosphere/mesos-dns/pull/169","diff_url":"https://github.com/mesosphere/mesos-dns/pull/169.diff","patch_url":"https://github.com/mesosphere/mesos-dns/pull/169.patch","issue_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/169","number":169,"state":"open","locked":false,"title":"Generate masterN.mesos record for current leader","user":{"login":"jdef","id":2348332,"avatar_url":"https://avatars.githubusercontent.com/u/2348332?v=3","gravatar_id":"","url":"https://api.github.com/users/jdef","html_url":"https://github.com/jdef","followers_url":"https://api.github.com/users/jdef/followers","following_url":"https://api.github.com/users/jdef/following{/other_user}","gists_url":"https://api.github.com/users/jdef/gists{/gist_id}","starred_url":"https://api.github.com/users/jdef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdef/subscriptions","organizations_url":"https://api.github.com/users/jdef/orgs","repos_url":"https://api.github.com/users/jdef/repos","events_url":"https://api.github.com/users/jdef/events{/privacy}","received_events_url":"https://api.github.com/users/jdef/received_events","type":"User","site_admin":false},"body":"Fixes #165","created_at":"2015-06-11T04:24:44Z","updated_at":"2015-06-11T10:01:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b2beec23cb7f00ad0d6965c61281406b38f4993","assignee":{"login":"tsenart","id":67471,"avatar_url":"https://avatars.githubusercontent.com/u/67471?v=3","gravatar_id":"","url":"https://api.github.com/users/tsenart","html_url":"https://github.com/tsenart","followers_url":"https://api.github.com/users/tsenart/followers","following_url":"https://api.github.com/users/tsenart/following{/other_user}","gists_url":"https://api.github.com/users/tsenart/gists{/gist_id}","starred_url":"https://api.github.com/users/tsenart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsenart/subscriptions","organizations_url":"https://api.github.com/users/tsenart/orgs","repos_url":"https://api.github.com/users/tsenart/repos","events_url":"https://api.github.com/users/tsenart/events{/privacy}","received_events_url":"https://api.github.com/users/tsenart/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169/commits","review_comments_url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169/comments","review_comment_url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/169/comments","statuses_url":"https://api.github.com/repos/mesosphere/mesos-dns/statuses/3fe4b415c0f0d717e8686b6efff31337e39e33ad","head":{"label":"mesosphere:fix-165","ref":"fix-165","sha":"3fe4b415c0f0d717e8686b6efff31337e39e33ad","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":26509179,"name":"mesos-dns","full_name":"mesosphere/mesos-dns","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/mesos-dns","description":" DNS-based service discovery for Mesos.","fork":false,"url":"https://api.github.com/repos/mesosphere/mesos-dns","forks_url":"https://api.github.com/repos/mesosphere/mesos-dns/forks","keys_url":"https://api.github.com/repos/mesosphere/mesos-dns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/mesos-dns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/mesos-dns/teams","hooks_url":"https://api.github.com/repos/mesosphere/mesos-dns/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/mesos-dns/events","assignees_url":"https://api.github.com/repos/mesosphere/mesos-dns/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/mesos-dns/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/mesos-dns/tags","blobs_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/mesos-dns/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/mesos-dns/languages","stargazers_url":"https://api.github.com/repos/mesosphere/mesos-dns/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/mesos-dns/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/mesos-dns/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/mesos-dns/subscription","commits_url":"https://api.github.com/repos/mesosphere/mesos-dns/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/mesos-dns/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/mesos-dns/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/mesos-dns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/mesos-dns/merges","archive_url":"https://api.github.com/repos/mesosphere/mesos-dns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/mesos-dns/downloads","issues_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/mesos-dns/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/mesos-dns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/mesos-dns/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/mesos-dns/releases{/id}","created_at":"2014-11-11T23:06:33Z","updated_at":"2015-06-09T15:19:57Z","pushed_at":"2015-06-11T04:24:44Z","git_url":"git://github.com/mesosphere/mesos-dns.git","ssh_url":"git@github.com:mesosphere/mesos-dns.git","clone_url":"https://github.com/mesosphere/mesos-dns.git","svn_url":"https://github.com/mesosphere/mesos-dns","homepage":"https://mesosphere.github.com/mesos-dns","size":2224,"stargazers_count":190,"watchers_count":190,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":26,"mirror_url":null,"open_issues_count":37,"forks":26,"open_issues":37,"watchers":190,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"3db0e63fa1f55ee8701e9b84d955cb96f1eae157","user":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":26509179,"name":"mesos-dns","full_name":"mesosphere/mesos-dns","owner":{"login":"mesosphere","id":3458585,"avatar_url":"https://avatars.githubusercontent.com/u/3458585?v=3","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/mesos-dns","description":" DNS-based service discovery for Mesos.","fork":false,"url":"https://api.github.com/repos/mesosphere/mesos-dns","forks_url":"https://api.github.com/repos/mesosphere/mesos-dns/forks","keys_url":"https://api.github.com/repos/mesosphere/mesos-dns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/mesos-dns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/mesos-dns/teams","hooks_url":"https://api.github.com/repos/mesosphere/mesos-dns/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/mesos-dns/events","assignees_url":"https://api.github.com/repos/mesosphere/mesos-dns/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/mesos-dns/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/mesos-dns/tags","blobs_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/mesos-dns/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/mesos-dns/languages","stargazers_url":"https://api.github.com/repos/mesosphere/mesos-dns/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/mesos-dns/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/mesos-dns/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/mesos-dns/subscription","commits_url":"https://api.github.com/repos/mesosphere/mesos-dns/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/mesos-dns/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/mesos-dns/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/mesos-dns/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/mesos-dns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/mesos-dns/merges","archive_url":"https://api.github.com/repos/mesosphere/mesos-dns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/mesos-dns/downloads","issues_url":"https://api.github.com/repos/mesosphere/mesos-dns/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/mesos-dns/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/mesos-dns/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/mesos-dns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/mesos-dns/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/mesos-dns/releases{/id}","created_at":"2014-11-11T23:06:33Z","updated_at":"2015-06-09T15:19:57Z","pushed_at":"2015-06-11T04:24:44Z","git_url":"git://github.com/mesosphere/mesos-dns.git","ssh_url":"git@github.com:mesosphere/mesos-dns.git","clone_url":"https://github.com/mesosphere/mesos-dns.git","svn_url":"https://github.com/mesosphere/mesos-dns","homepage":"https://mesosphere.github.com/mesos-dns","size":2224,"stargazers_count":190,"watchers_count":190,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":26,"mirror_url":null,"open_issues_count":37,"forks":26,"open_issues":37,"watchers":190,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169"},"html":{"href":"https://github.com/mesosphere/mesos-dns/pull/169"},"issue":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/issues/169"},"comments":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/issues/169/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/pulls/169/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/mesos-dns/statuses/3fe4b415c0f0d717e8686b6efff31337e39e33ad"}}}}