From 5de2bea1b4c945d8d26f0cde5bb3545e9a7600d6 Mon Sep 17 00:00:00 2001 From: Aleksandr Sergin Date: Fri, 23 Aug 2019 19:31:01 +0300 Subject: [PATCH] fix linter error --- yq.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/yq.go b/yq.go index 2aa87c04..d41d311b 100644 --- a/yq.go +++ b/yq.go @@ -46,12 +46,18 @@ func MoveFile(sourcePath, destPath string) error { } outputFile, err := os.Create(destPath) if err != nil { - inputFile.Close() + err = inputFile.Close() + if err != nil { + return fmt.Errorf("Failed close original file: %s", err) + } return fmt.Errorf("couldn't open dest file: %s", err) } defer outputFile.Close() _, err = io.Copy(outputFile, inputFile) - inputFile.Close() + err = inputFile.Close() + if err != nil { + return fmt.Errorf("Failed close original file: %s", err) + } if err != nil { return fmt.Errorf("writing to output file failed: %s", err) }