simplify channel send() in WalkDir() (#18186)

This commit is contained in:
Maxim Tkachenko 2023-10-10 07:27:55 +07:00 committed by GitHub
parent 7cd08594f6
commit ec30bb89a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.
}