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 /modules/markup/external/external.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 'modules/markup/external/external.go')
-rw-r--r-- | modules/markup/external/external.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/markup/external/external.go b/modules/markup/external/external.go index 23dd45ba0a..0eeb2d70a5 100644 --- a/modules/markup/external/external.go +++ b/modules/markup/external/external.go @@ -90,7 +90,7 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io. // write to temp file f, err := os.CreateTemp("", "gitea_input") if err != nil { - return fmt.Errorf("%s create temp file when rendering %s failed: %v", p.Name(), p.Command, err) + return fmt.Errorf("%s create temp file when rendering %s failed: %w", p.Name(), p.Command, err) } tmpPath := f.Name() defer func() { @@ -102,12 +102,12 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io. _, err = io.Copy(f, input) if err != nil { f.Close() - return fmt.Errorf("%s write data to temp file when rendering %s failed: %v", p.Name(), p.Command, err) + return fmt.Errorf("%s write data to temp file when rendering %s failed: %w", p.Name(), p.Command, err) } err = f.Close() if err != nil { - return fmt.Errorf("%s close temp file when rendering %s failed: %v", p.Name(), p.Command, err) + return fmt.Errorf("%s close temp file when rendering %s failed: %w", p.Name(), p.Command, err) } args = append(args, f.Name()) } @@ -137,7 +137,7 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io. process.SetSysProcAttribute(cmd) if err := cmd.Run(); err != nil { - return fmt.Errorf("%s render run command %s %v failed: %v", p.Name(), commands[0], args, err) + return fmt.Errorf("%s render run command %s %v failed: %w", p.Name(), commands[0], args, err) } return nil } |