summaryrefslogtreecommitdiffstats
path: root/modules/avatar
diff options
context:
space:
mode:
authordelvh <leon@kske.dev>2022-10-24 21:29:17 +0200
committerGitHub <noreply@github.com>2022-10-24 20:29:17 +0100
commit0ebb45cfe7606adf021ad359d6fbfcefc54360a5 (patch)
tree541b75d083213e93bbbfadbdc5d560c739543903 /modules/avatar
parent7c11a73833f3aa9783015e5e13871d3c298d3ef6 (diff)
downloadgitea-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 'modules/avatar')
-rw-r--r--modules/avatar/avatar.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go
index 6ca75ed90f..2de77de009 100644
--- a/modules/avatar/avatar.go
+++ b/modules/avatar/avatar.go
@@ -30,7 +30,7 @@ func RandomImageSize(size int, data []byte) (image.Image, error) {
// we use white as background, and use dark colors to draw blocks
imgMaker, err := identicon.New(size, color.White, identicon.DarkColors...)
if err != nil {
- return nil, fmt.Errorf("identicon.New: %v", err)
+ return nil, fmt.Errorf("identicon.New: %w", err)
}
return imgMaker.Make(data), nil
}
@@ -46,7 +46,7 @@ func RandomImage(data []byte) (image.Image, error) {
func Prepare(data []byte) (*image.Image, error) {
imgCfg, _, err := image.DecodeConfig(bytes.NewReader(data))
if err != nil {
- return nil, fmt.Errorf("DecodeConfig: %v", err)
+ return nil, fmt.Errorf("DecodeConfig: %w", err)
}
if imgCfg.Width > setting.Avatar.MaxWidth {
return nil, fmt.Errorf("Image width is too large: %d > %d", imgCfg.Width, setting.Avatar.MaxWidth)
@@ -57,7 +57,7 @@ func Prepare(data []byte) (*image.Image, error) {
img, _, err := image.Decode(bytes.NewReader(data))
if err != nil {
- return nil, fmt.Errorf("Decode: %v", err)
+ return nil, fmt.Errorf("Decode: %w", err)
}
if imgCfg.Width != imgCfg.Height {