From 563c1d9bd756aeca03e3b31b939d11940ac6227a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 16 Feb 2024 18:24:27 +0300 Subject: [PATCH] [#308] Fix linter issues Signed-off-by: Alex Vanin --- api/cache/listsession.go | 2 +- api/handler/copy.go | 8 ++++---- api/handler/multipart_upload_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/cache/listsession.go b/api/cache/listsession.go index 7858c10..c8d0b68 100644 --- a/api/cache/listsession.go +++ b/api/cache/listsession.go @@ -48,7 +48,7 @@ func (k *ListSessionKey) String() string { // NewListSessionCache is a constructor which creates an object of ListObjectsCache with the given lifetime of entries. func NewListSessionCache(config *Config) *ListSessionCache { - gc := gcache.New(config.Size).LRU().Expiration(config.Lifetime).EvictedFunc(func(key interface{}, val interface{}) { + gc := gcache.New(config.Size).LRU().Expiration(config.Lifetime).EvictedFunc(func(_ interface{}, val interface{}) { session, ok := val.(*data.ListSession) if !ok { config.Logger.Warn(logs.InvalidCacheEntryType, zap.String("actual", fmt.Sprintf("%T", val)), diff --git a/api/handler/copy.go b/api/handler/copy.go index fea6ceb..2083b31 100644 --- a/api/handler/copy.go +++ b/api/handler/copy.go @@ -129,15 +129,15 @@ func (h *handler) CopyObjectHandler(w http.ResponseWriter, r *http.Request) { } var dstSize uint64 - if srcSize, err := layer.GetObjectSize(srcObjInfo); err != nil { + srcSize, err := layer.GetObjectSize(srcObjInfo) + if err != nil { h.logAndSendError(w, "failed to get source object size", reqInfo, err) return - } else if srcSize > layer.UploadMaxSize { //https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html + } else if srcSize > layer.UploadMaxSize { // https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html h.logAndSendError(w, "too bid object to copy with single copy operation, use multipart upload copy instead", reqInfo, errors.GetAPIError(errors.ErrInvalidRequestLargeCopy)) return - } else { - dstSize = srcSize } + dstSize = srcSize args, err := parseCopyObjectArgs(r.Header) if err != nil { diff --git a/api/handler/multipart_upload_test.go b/api/handler/multipart_upload_test.go index a6dd9bc..c02220e 100644 --- a/api/handler/multipart_upload_test.go +++ b/api/handler/multipart_upload_test.go @@ -180,7 +180,7 @@ func TestMultipartUploadSize(t *testing.T) { equalDataSlices(t, data[partSize:], part) }) - t.Run("check correct size when part copy", func(t *testing.T) { + t.Run("check correct size when part copy", func(_ *testing.T) { objName2 := "obj2" uploadInfo := createMultipartUpload(hc, bktName, objName2, headers) sourceCopy := bktName + "/" + objName