mirror of
https://github.com/go-gitea/gitea
synced 2025-07-15 23:17:19 +00:00
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>
This commit is contained in:
@@ -95,13 +95,13 @@ func GetIndexerStatus(ctx context.Context, repo *Repository, indexerType RepoInd
|
||||
func UpdateIndexerStatus(ctx context.Context, repo *Repository, indexerType RepoIndexerType, sha string) error {
|
||||
status, err := GetIndexerStatus(ctx, repo, indexerType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("UpdateIndexerStatus: Unable to getIndexerStatus for repo: %s Error: %v", repo.FullName(), err)
|
||||
return fmt.Errorf("UpdateIndexerStatus: Unable to getIndexerStatus for repo: %s Error: %w", repo.FullName(), err)
|
||||
}
|
||||
|
||||
if len(status.CommitSha) == 0 {
|
||||
status.CommitSha = sha
|
||||
if err := db.Insert(ctx, status); err != nil {
|
||||
return fmt.Errorf("UpdateIndexerStatus: Unable to insert repoIndexerStatus for repo: %s Sha: %s Error: %v", repo.FullName(), sha, err)
|
||||
return fmt.Errorf("UpdateIndexerStatus: Unable to insert repoIndexerStatus for repo: %s Sha: %s Error: %w", repo.FullName(), sha, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func UpdateIndexerStatus(ctx context.Context, repo *Repository, indexerType Repo
|
||||
_, err = db.GetEngine(ctx).ID(status.ID).Cols("commit_sha").
|
||||
Update(status)
|
||||
if err != nil {
|
||||
return fmt.Errorf("UpdateIndexerStatus: Unable to update repoIndexerStatus for repo: %s Sha: %s Error: %v", repo.FullName(), sha, err)
|
||||
return fmt.Errorf("UpdateIndexerStatus: Unable to update repoIndexerStatus for repo: %s Sha: %s Error: %w", repo.FullName(), sha, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user