diff options
author | delvh <leon@kske.dev> | 2022-10-24 21:29:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-24 20:29:17 +0100 |
commit | 0ebb45cfe7606adf021ad359d6fbfcefc54360a5 (patch) | |
tree | 541b75d083213e93bbbfadbdc5d560c739543903 /models/issues/issue_list.go | |
parent | 7c11a73833f3aa9783015e5e13871d3c298d3ef6 (diff) | |
download | gitea-0ebb45cfe7606adf021ad359d6fbfcefc54360a5.tar.gz gitea-0ebb45cfe7606adf021ad359d6fbfcefc54360a5.zip |
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551)
Found using
`find . -type f -name '*.go' -print -exec vim {} -c
':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;`
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/issues/issue_list.go')
-rw-r--r-- | models/issues/issue_list.go | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index deadb6a564..bbe2292dd1 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -51,7 +51,7 @@ func (issues IssueList) loadRepositories(ctx context.Context) ([]*repo_model.Rep In("id", repoIDs[:limit]). Find(&repoMaps) if err != nil { - return nil, fmt.Errorf("find repository: %v", err) + return nil, fmt.Errorf("find repository: %w", err) } left -= limit repoIDs = repoIDs[limit:] @@ -161,7 +161,7 @@ func (issues IssueList) loadLabels(ctx context.Context) error { err = rows.Scan(&labelIssue) if err != nil { if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadLabels: Close: %v", err1) + return fmt.Errorf("IssueList.loadLabels: Close: %w", err1) } return err } @@ -170,7 +170,7 @@ func (issues IssueList) loadLabels(ctx context.Context) error { // When there are no rows left and we try to close it. // Since that is not relevant for us, we can safely ignore it. if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadLabels: Close: %v", err1) + return fmt.Errorf("IssueList.loadLabels: Close: %w", err1) } left -= limit issueIDs = issueIDs[limit:] @@ -287,7 +287,7 @@ func (issues IssueList) loadAssignees(ctx context.Context) error { err = rows.Scan(&assigneeIssue) if err != nil { if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadAssignees: Close: %v", err1) + return fmt.Errorf("IssueList.loadAssignees: Close: %w", err1) } return err } @@ -295,7 +295,7 @@ func (issues IssueList) loadAssignees(ctx context.Context) error { assignees[assigneeIssue.IssueAssignee.IssueID] = append(assignees[assigneeIssue.IssueAssignee.IssueID], assigneeIssue.Assignee) } if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadAssignees: Close: %v", err1) + return fmt.Errorf("IssueList.loadAssignees: Close: %w", err1) } left -= limit issueIDs = issueIDs[limit:] @@ -342,14 +342,14 @@ func (issues IssueList) loadPullRequests(ctx context.Context) error { err = rows.Scan(&pr) if err != nil { if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadPullRequests: Close: %v", err1) + return fmt.Errorf("IssueList.loadPullRequests: Close: %w", err1) } return err } pullRequestMaps[pr.IssueID] = &pr } if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadPullRequests: Close: %v", err1) + return fmt.Errorf("IssueList.loadPullRequests: Close: %w", err1) } left -= limit issuesIDs = issuesIDs[limit:] @@ -387,14 +387,14 @@ func (issues IssueList) loadAttachments(ctx context.Context) (err error) { err = rows.Scan(&attachment) if err != nil { if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadAttachments: Close: %v", err1) + return fmt.Errorf("IssueList.loadAttachments: Close: %w", err1) } return err } attachments[attachment.IssueID] = append(attachments[attachment.IssueID], &attachment) } if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadAttachments: Close: %v", err1) + return fmt.Errorf("IssueList.loadAttachments: Close: %w", err1) } left -= limit issuesIDs = issuesIDs[limit:] @@ -433,14 +433,14 @@ func (issues IssueList) loadComments(ctx context.Context, cond builder.Cond) (er err = rows.Scan(&comment) if err != nil { if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadComments: Close: %v", err1) + return fmt.Errorf("IssueList.loadComments: Close: %w", err1) } return err } comments[comment.IssueID] = append(comments[comment.IssueID], &comment) } if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadComments: Close: %v", err1) + return fmt.Errorf("IssueList.loadComments: Close: %w", err1) } left -= limit issuesIDs = issuesIDs[limit:] @@ -492,14 +492,14 @@ func (issues IssueList) loadTotalTrackedTimes(ctx context.Context) (err error) { err = rows.Scan(&totalTime) if err != nil { if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadTotalTrackedTimes: Close: %v", err1) + return fmt.Errorf("IssueList.loadTotalTrackedTimes: Close: %w", err1) } return err } trackedTimes[totalTime.IssueID] = totalTime.Time } if err1 := rows.Close(); err1 != nil { - return fmt.Errorf("IssueList.loadTotalTrackedTimes: Close: %v", err1) + return fmt.Errorf("IssueList.loadTotalTrackedTimes: Close: %w", err1) } left -= limit ids = ids[limit:] @@ -514,35 +514,35 @@ func (issues IssueList) loadTotalTrackedTimes(ctx context.Context) (err error) { // loadAttributes loads all attributes, expect for attachments and comments func (issues IssueList) loadAttributes(ctx context.Context) error { if _, err := issues.loadRepositories(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadRepositories: %v", err) + return fmt.Errorf("issue.loadAttributes: loadRepositories: %w", err) } if err := issues.loadPosters(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadPosters: %v", err) + return fmt.Errorf("issue.loadAttributes: loadPosters: %w", err) } if err := issues.loadLabels(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadLabels: %v", err) + return fmt.Errorf("issue.loadAttributes: loadLabels: %w", err) } if err := issues.loadMilestones(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadMilestones: %v", err) + return fmt.Errorf("issue.loadAttributes: loadMilestones: %w", err) } if err := issues.loadProjects(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadProjects: %v", err) + return fmt.Errorf("issue.loadAttributes: loadProjects: %w", err) } if err := issues.loadAssignees(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadAssignees: %v", err) + return fmt.Errorf("issue.loadAttributes: loadAssignees: %w", err) } if err := issues.loadPullRequests(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadPullRequests: %v", err) + return fmt.Errorf("issue.loadAttributes: loadPullRequests: %w", err) } if err := issues.loadTotalTrackedTimes(ctx); err != nil { - return fmt.Errorf("issue.loadAttributes: loadTotalTrackedTimes: %v", err) + return fmt.Errorf("issue.loadAttributes: loadTotalTrackedTimes: %w", err) } return nil |