From 4a3314e6395ca9681b79acda5a7abede12624889 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Tue, 24 Oct 2023 13:11:08 -0700 Subject: [PATCH] Fix local variables (#25) --- cmd/erasure-object.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index 57db855c6d99b9..e62cf1f2f9edff 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -716,13 +716,8 @@ func readAllXL(ctx context.Context, disks []StorageAPI, bucket, object string, r return pickLatestQuorumFilesInfo(ctx, rawFileInfos, errs, bucket, object, readData, inclFreeVers, allParts) } -func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object string, opts ObjectOptions, readData bool) (fi FileInfo, onlineMeta []FileInfo, onlineDisks []StorageAPI, err error) { - var ( - modTime time.Time - etag string - - mu sync.Mutex - ) +func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object string, opts ObjectOptions, readData bool) (FileInfo, []FileInfo, []StorageAPI, error) { + var mu sync.Mutex rawArr := make([]RawFileInfo, er.setDriveCount) metaArr := make([]FileInfo, er.setDriveCount) @@ -836,18 +831,27 @@ func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object s if err != nil { return FileInfo{}, nil, nil, time.Time{}, "", err } - onlineDisks, modTime, etag = listOnlineDisks(disks, metaArr, errs, readQuorum) - fi, err = pickValidFileInfo(ctx, metaArr, modTime, etag, readQuorum) + onlineDisks, modTime, etag := listOnlineDisks(disks, metaArr, errs, readQuorum) + fi, err := pickValidFileInfo(ctx, metaArr, modTime, etag, readQuorum) if err != nil { return FileInfo{}, nil, nil, time.Time{}, "", err } - onlineMeta = make([]FileInfo, len(metaArr)) + onlineMeta := make([]FileInfo, len(metaArr)) copy(onlineMeta, metaArr) return fi, onlineMeta, onlineDisks, modTime, etag, nil } + var ( + modTime time.Time + etag string + fi FileInfo + onlineMeta []FileInfo + onlineDisks []StorageAPI + err error + ) + for success := range done { totalResp++ if success {