From 41161a6e12807bcc151bddc5f9fde6619108e228 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Wed, 17 Jan 2024 18:27:05 +0800 Subject: [PATCH] refactor(storage/s3): remove redundant len check Signed-off-by: Eng Zer Jun --- registry/storage/driver/s3-aws/s3.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/registry/storage/driver/s3-aws/s3.go b/registry/storage/driver/s3-aws/s3.go index 60e205dbc..40d302669 100644 --- a/registry/storage/driver/s3-aws/s3.go +++ b/registry/storage/driver/s3-aws/s3.go @@ -1128,16 +1128,14 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, from stri // get a list of all inferred directories between the previous directory and this file dirs := directoryDiff(prevDir, filePath) - if len(dirs) > 0 { - for _, dir := range dirs { - walkInfos = append(walkInfos, storagedriver.FileInfoInternal{ - FileInfoFields: storagedriver.FileInfoFields{ - IsDir: true, - Path: dir, - }, - }) - prevDir = dir - } + for _, dir := range dirs { + walkInfos = append(walkInfos, storagedriver.FileInfoInternal{ + FileInfoFields: storagedriver.FileInfoFields{ + IsDir: true, + Path: dir, + }, + }) + prevDir = dir } walkInfos = append(walkInfos, storagedriver.FileInfoInternal{