-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Refactor for issues loadattributes of a repository #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor for issues loadattributes of a repository #971
Conversation
models/issue_list.go
Outdated
| type IssueList []*Issue | ||
|
|
||
| func (issues IssueList) getRepoIDs() []int64 { | ||
| repoIDs := make([]int64, 0, len(issues)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest doing something like
repoIDs := make(map[int64]bool, len(issues))
for _, issue := range issues {
repoIDs[issue.RepoID] = true
}
return keys(repoIDs) // keys is a helper function (map[int64]bool) -> []int64
This is more efficient, and more concise (since the keys helper function can be shared across the getSomethingIDs functions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
|
This PR is depended on #987. |
|
LGTM |
|
LGTM |
No description provided.