1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 18:58:38 +00:00

chore(models): rewrite code format. (#14754)

* chore: rewrite format.

* chore: update format

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: update format

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* chore: Adjacent parameters with the same type should be grouped together

* chore: update format.
This commit is contained in:
Bo-Yi Wu
2021-03-15 02:52:12 +08:00
committed by GitHub
parent 164e35ead3
commit 167b0f46ef
103 changed files with 474 additions and 460 deletions

View File

@@ -24,9 +24,9 @@ func (comments CommentList) loadPosters(e Engine) error {
posterIDs := comments.getPosterIDs()
posterMaps := make(map[int64]*User, len(posterIDs))
var left = len(posterIDs)
left := len(posterIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -53,7 +53,7 @@ func (comments CommentList) loadPosters(e Engine) error {
}
func (comments CommentList) getCommentIDs() []int64 {
var ids = make([]int64, 0, len(comments))
ids := make([]int64, 0, len(comments))
for _, comment := range comments {
ids = append(ids, comment.ID)
}
@@ -61,7 +61,7 @@ func (comments CommentList) getCommentIDs() []int64 {
}
func (comments CommentList) getLabelIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if _, ok := ids[comment.LabelID]; !ok {
ids[comment.LabelID] = struct{}{}
@@ -75,11 +75,11 @@ func (comments CommentList) loadLabels(e Engine) error {
return nil
}
var labelIDs = comments.getLabelIDs()
var commentLabels = make(map[int64]*Label, len(labelIDs))
var left = len(labelIDs)
labelIDs := comments.getLabelIDs()
commentLabels := make(map[int64]*Label, len(labelIDs))
left := len(labelIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -111,7 +111,7 @@ func (comments CommentList) loadLabels(e Engine) error {
}
func (comments CommentList) getMilestoneIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if _, ok := ids[comment.MilestoneID]; !ok {
ids[comment.MilestoneID] = struct{}{}
@@ -131,9 +131,9 @@ func (comments CommentList) loadMilestones(e Engine) error {
}
milestoneMaps := make(map[int64]*Milestone, len(milestoneIDs))
var left = len(milestoneIDs)
left := len(milestoneIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -154,7 +154,7 @@ func (comments CommentList) loadMilestones(e Engine) error {
}
func (comments CommentList) getOldMilestoneIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if _, ok := ids[comment.OldMilestoneID]; !ok {
ids[comment.OldMilestoneID] = struct{}{}
@@ -174,9 +174,9 @@ func (comments CommentList) loadOldMilestones(e Engine) error {
}
milestoneMaps := make(map[int64]*Milestone, len(milestoneIDs))
var left = len(milestoneIDs)
left := len(milestoneIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -197,7 +197,7 @@ func (comments CommentList) loadOldMilestones(e Engine) error {
}
func (comments CommentList) getAssigneeIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if _, ok := ids[comment.AssigneeID]; !ok {
ids[comment.AssigneeID] = struct{}{}
@@ -211,11 +211,11 @@ func (comments CommentList) loadAssignees(e Engine) error {
return nil
}
var assigneeIDs = comments.getAssigneeIDs()
var assignees = make(map[int64]*User, len(assigneeIDs))
var left = len(assigneeIDs)
assigneeIDs := comments.getAssigneeIDs()
assignees := make(map[int64]*User, len(assigneeIDs))
left := len(assigneeIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -250,7 +250,7 @@ func (comments CommentList) loadAssignees(e Engine) error {
// getIssueIDs returns all the issue ids on this comment list which issue hasn't been loaded
func (comments CommentList) getIssueIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if comment.Issue != nil {
continue
@@ -264,7 +264,7 @@ func (comments CommentList) getIssueIDs() []int64 {
// Issues returns all the issues of comments
func (comments CommentList) Issues() IssueList {
var issues = make(map[int64]*Issue, len(comments))
issues := make(map[int64]*Issue, len(comments))
for _, comment := range comments {
if comment.Issue != nil {
if _, ok := issues[comment.Issue.ID]; !ok {
@@ -273,7 +273,7 @@ func (comments CommentList) Issues() IssueList {
}
}
var issueList = make([]*Issue, 0, len(issues))
issueList := make([]*Issue, 0, len(issues))
for _, issue := range issues {
issueList = append(issueList, issue)
}
@@ -285,11 +285,11 @@ func (comments CommentList) loadIssues(e Engine) error {
return nil
}
var issueIDs = comments.getIssueIDs()
var issues = make(map[int64]*Issue, len(issueIDs))
var left = len(issueIDs)
issueIDs := comments.getIssueIDs()
issues := make(map[int64]*Issue, len(issueIDs))
left := len(issueIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -325,7 +325,7 @@ func (comments CommentList) loadIssues(e Engine) error {
}
func (comments CommentList) getDependentIssueIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if comment.DependentIssue != nil {
continue
@@ -342,11 +342,11 @@ func (comments CommentList) loadDependentIssues(e Engine) error {
return nil
}
var issueIDs = comments.getDependentIssueIDs()
var issues = make(map[int64]*Issue, len(issueIDs))
var left = len(issueIDs)
issueIDs := comments.getDependentIssueIDs()
issues := make(map[int64]*Issue, len(issueIDs))
left := len(issueIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -391,11 +391,11 @@ func (comments CommentList) loadAttachments(e Engine) (err error) {
return nil
}
var attachments = make(map[int64][]*Attachment, len(comments))
var commentsIDs = comments.getCommentIDs()
var left = len(commentsIDs)
attachments := make(map[int64][]*Attachment, len(comments))
commentsIDs := comments.getCommentIDs()
left := len(commentsIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}
@@ -429,7 +429,7 @@ func (comments CommentList) loadAttachments(e Engine) (err error) {
}
func (comments CommentList) getReviewIDs() []int64 {
var ids = make(map[int64]struct{}, len(comments))
ids := make(map[int64]struct{}, len(comments))
for _, comment := range comments {
if _, ok := ids[comment.ReviewID]; !ok {
ids[comment.ReviewID] = struct{}{}
@@ -443,11 +443,11 @@ func (comments CommentList) loadReviews(e Engine) error {
return nil
}
var reviewIDs = comments.getReviewIDs()
var reviews = make(map[int64]*Review, len(reviewIDs))
var left = len(reviewIDs)
reviewIDs := comments.getReviewIDs()
reviews := make(map[int64]*Review, len(reviewIDs))
left := len(reviewIDs)
for left > 0 {
var limit = defaultMaxInSize
limit := defaultMaxInSize
if left < limit {
limit = left
}