chore: use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))

Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
guangwu
2023-07-07 11:00:36 +08:00
committed by GitHub
parent cc34c6309e
commit 06e7b0ab70
4 changed files with 6 additions and 8 deletions

View File

@@ -5,7 +5,6 @@ import (
"net/http"
"net/url"
"os"
"errors"
"fmt"
)
@@ -39,7 +38,7 @@ func DownloadAndSaveFile(remoteUrl, dstFile string) (error) {
if resp.StatusCode == http.StatusOK {
_, err = io.Copy(out, resp.Body)
}else{
return errors.New(fmt.Sprintf("bad status: %s", resp.Status))
return fmt.Errorf("bad status: %s", resp.Status)
}
return nil
}