From 302c68a3832ef40aacbadbdcc22e2a14061c6d9c Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Tue, 16 Aug 2022 14:25:55 +0200 Subject: [PATCH] Check err and correctly close file for S3 storage Signed-off-by: Mustafa Gezen --- peridot/lookaside/s3/s3.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/peridot/lookaside/s3/s3.go b/peridot/lookaside/s3/s3.go index 6829f3e0..b21db5a7 100644 --- a/peridot/lookaside/s3/s3.go +++ b/peridot/lookaside/s3/s3.go @@ -96,6 +96,7 @@ func (s *Storage) DownloadObject(objectName string, path string) error { if err != nil { return err } + defer f.Close() _, err = s.downloader.Download( f, @@ -105,7 +106,7 @@ func (s *Storage) DownloadObject(objectName string, path string) error { }, ) - return nil + return err } func (s *Storage) ReadObject(objectName string) ([]byte, error) {