From 17e1eb0436fae0ed12fbc1c3e8092c29da06e4e3 Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Mon, 3 Feb 2020 10:55:12 +1030 Subject: [PATCH] filter: basic: add error checking for close() --- filter/basic.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/filter/basic.go b/filter/basic.go index 7cc24b9e..3aeca7db 100644 --- a/filter/basic.go +++ b/filter/basic.go @@ -80,7 +80,10 @@ func NewBasic(dst io.WriteCloser, debug bool, t, p int) *Basic { // Implements io.Closer. func (bf *Basic) Close() error { if bf.debug { - bf.file.Close() + err := bf.file.Close() + if err != nil { + return fmt.Errorf("file cannot be closed: %w", err) + } } return nil }