uniqueSearchIssuesRepos extracts the owner/repo pairs of every issue in the search result, preserving order of first appearance and deduplicating.
(result *github.IssuesSearchResult)
| 1629 | // uniqueSearchIssuesRepos extracts the owner/repo pairs of every issue in the |
| 1630 | // search result, preserving order of first appearance and deduplicating. |
| 1631 | func uniqueSearchIssuesRepos(result *github.IssuesSearchResult) []searchIssuesRepoRef { |
| 1632 | if result == nil { |
| 1633 | return nil |
| 1634 | } |
| 1635 | seen := make(map[string]struct{}) |
| 1636 | var out []searchIssuesRepoRef |
| 1637 | for _, issue := range result.Issues { |
| 1638 | if issue == nil { |
| 1639 | continue |
| 1640 | } |
| 1641 | owner, repo, ok := parseRepositoryURL(issue.GetRepositoryURL()) |
| 1642 | if !ok { |
| 1643 | continue |
| 1644 | } |
| 1645 | key := owner + "/" + repo |
| 1646 | if _, dup := seen[key]; dup { |
| 1647 | continue |
| 1648 | } |
| 1649 | seen[key] = struct{}{} |
| 1650 | out = append(out, searchIssuesRepoRef{owner: owner, repo: repo}) |
| 1651 | } |
| 1652 | return out |
| 1653 | } |
| 1654 | |
| 1655 | // parseRepositoryURL extracts the owner and repo from a GitHub API repository |
| 1656 | // URL of the form https://api.github.com/repos/{owner}/{repo}. |
no test coverage detected