From ec30bb89a43ae2fd09128adba648fdc7fe64a3e5 Mon Sep 17 00:00:00 2001 From: Maxim Tkachenko Date: Tue, 10 Oct 2023 07:27:55 +0700 Subject: [PATCH] simplify channel send() in WalkDir() (#18186) --- cmd/metacache-walk.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/metacache-walk.go b/cmd/metacache-walk.go index 795ede414..d8f35bf59 100644 --- a/cmd/metacache-walk.go +++ b/cmd/metacache-walk.go @@ -251,10 +251,8 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ meta.name = strings.TrimSuffix(meta.name, SlashSeparator) meta.name = pathJoinBuf(sb, current, meta.name) meta.name = decodeDirObject(meta.name) - if err := send(meta); err != nil { - return err - } - return nil + + return send(meta) } // Check legacy. if HasSuffix(entry, xlStorageFormatFileV1) && legacy { @@ -270,10 +268,8 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ meta.name = strings.TrimSuffix(entry, xlStorageFormatFileV1) meta.name = strings.TrimSuffix(meta.name, SlashSeparator) meta.name = pathJoinBuf(sb, current, meta.name) - if err := send(meta); err != nil { - return err - } - return nil + + return send(meta) } // Skip all other files. }