From bff3ef3db4bd8bd2a089c5e62806cb3a5beb315b Mon Sep 17 00:00:00 2001 From: Yao Zengzeng Date: Fri, 19 Jul 2019 17:16:34 +0800 Subject: [PATCH] minor enhancement: return multi error when closeAll() (#663) Signed-off-by: YaoZengzeng --- chunks/chunks.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chunks/chunks.go b/chunks/chunks.go index 04b34c9f0..bd7b9e765 100644 --- a/chunks/chunks.go +++ b/chunks/chunks.go @@ -502,11 +502,11 @@ func sequenceFiles(dir string) ([]string, error) { return res, nil } -func closeAll(cs []io.Closer) (err error) { +func closeAll(cs []io.Closer) error { + var merr tsdb_errors.MultiError + for _, c := range cs { - if e := c.Close(); e != nil { - err = e - } + merr.Add(c.Close()) } - return err + return merr.Err() }