From f5e3eedf3458c9f5b580edac643292213c1322e7 Mon Sep 17 00:00:00 2001 From: Andi <36215014+ChengenH@users.noreply.github.com> Date: Thu, 9 May 2024 16:44:07 +0800 Subject: [PATCH] chore: use errors.New to replace fmt.Errorf with no parameters (#19568) Signed-off-by: ChengenH --- cmd/admin-heal-ops.go | 4 ++-- cmd/httprange.go | 2 +- cmd/tier.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/admin-heal-ops.go b/cmd/admin-heal-ops.go index 40091553f..a7257d34f 100644 --- a/cmd/admin-heal-ops.go +++ b/cmd/admin-heal-ops.go @@ -63,8 +63,8 @@ const ( ) var ( - errHealIdleTimeout = fmt.Errorf("healing results were not consumed for too long") - errHealStopSignalled = fmt.Errorf("heal stop signaled") + errHealIdleTimeout = errors.New("healing results were not consumed for too long") + errHealStopSignalled = errors.New("heal stop signaled") errFnHealFromAPIErr = func(ctx context.Context, err error) error { apiErr := toAdminAPIErr(ctx, err) diff --git a/cmd/httprange.go b/cmd/httprange.go index 2e198d474..d6b51f72d 100644 --- a/cmd/httprange.go +++ b/cmd/httprange.go @@ -197,7 +197,7 @@ func (h *HTTPRangeSpec) ToHeader() (string, error) { case h.Start > -1: end = "" default: - return "", fmt.Errorf("does not have valid range value") + return "", errors.New("does not have valid range value") } return fmt.Sprintf("bytes=%s-%s", start, end), nil } diff --git a/cmd/tier.go b/cmd/tier.go index 556699c75..48b545453 100644 --- a/cmd/tier.go +++ b/cmd/tier.go @@ -558,7 +558,7 @@ func loadTierConfig(ctx context.Context, objAPI ObjectLayer) (*TierConfigMgr, er } if len(data) <= 4 { - return nil, fmt.Errorf("tierConfigInit: no data") + return nil, errors.New("tierConfigInit: no data") } // Read header