From 0e88fa021a378fedc7c231b8f79b6fe538c7cba4 Mon Sep 17 00:00:00 2001 From: Rustam Gilyazov <16064414+rusq@users.noreply.github.com> Date: Sat, 30 Mar 2024 13:01:03 +1000 Subject: [PATCH] use join errors --- internal/chunk/dirproc/base.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/chunk/dirproc/base.go b/internal/chunk/dirproc/base.go index 5acbddd5..7ddb5fb8 100644 --- a/internal/chunk/dirproc/base.go +++ b/internal/chunk/dirproc/base.go @@ -1,6 +1,7 @@ package dirproc import ( + "errors" "io" "sync/atomic" @@ -35,13 +36,13 @@ func (p *baseproc) Close() error { if p.closed.Load() { return nil } + var errs error if err := p.Recorder.Close(); err != nil { - p.wc.Close() - return err + errors.Join(errs, err) } p.closed.Store(true) if err := p.wc.Close(); err != nil { - return err + errors.Join(errs, err) } - return nil + return errs }