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:
delvh 2022-10-24 21:29:17 +02:00 committed by GitHub
parent 7c11a73833
commit 0ebb45cfe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
207 changed files with 857 additions and 857 deletions

View file

@ -1197,7 +1197,7 @@ func UpdateAvatarSetting(ctx *context.Context, form forms.AvatarForm) error {
r, err := form.Avatar.Open()
if err != nil {
return fmt.Errorf("Avatar.Open: %v", err)
return fmt.Errorf("Avatar.Open: %w", err)
}
defer r.Close()
@ -1207,14 +1207,14 @@ func UpdateAvatarSetting(ctx *context.Context, form forms.AvatarForm) error {
data, err := io.ReadAll(r)
if err != nil {
return fmt.Errorf("io.ReadAll: %v", err)
return fmt.Errorf("io.ReadAll: %w", err)
}
st := typesniffer.DetectContentType(data)
if !(st.IsImage() && !st.IsSvgImage()) {
return errors.New(ctx.Tr("settings.uploaded_avatar_not_a_image"))
}
if err = repo_service.UploadAvatar(ctxRepo, data); err != nil {
return fmt.Errorf("UploadAvatar: %v", err)
return fmt.Errorf("UploadAvatar: %w", err)
}
return nil
}