Skip to content

Commit 2da1ee8

Browse files
author
Lauri Piispanen
committed
deduplicate users
1 parent 9567877 commit 2da1ee8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

github/github.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func (client HTTPGithubClient) User(login string) (User, error) {
6262

6363
func (client HTTPGithubClient) SearchUsers(query UserSearchQuery) ([]User, error) {
6464
users := []User{}
65+
userLogins := map[string]bool{}
6566

6667
totalCount := 0
6768
minFollowerCount := -1
@@ -171,7 +172,11 @@ Pages:
171172
ContributionCount: contributionCount,
172173
PublicContributionCount: (contributionCount - privateContributionCount),
173174
PrivateContributionCount: privateContributionCount}
174-
users = append(users, user)
175+
176+
if !userLogins[login] {
177+
userLogins[login] = true
178+
users = append(users, user)
179+
}
175180

176181
previousCursor = edgeNode["cursor"].(string)
177182
minFollowerCount = int(followerCount)

0 commit comments

Comments
 (0)