fix linter error

This commit is contained in:
Aleksandr Sergin 2019-08-23 19:31:01 +03:00 committed by Mike Farah
parent 7320b8d3c9
commit 5de2bea1b4

10
yq.go
View File

@ -46,12 +46,18 @@ func MoveFile(sourcePath, destPath string) error {
} }
outputFile, err := os.Create(destPath) outputFile, err := os.Create(destPath)
if err != nil { 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) return fmt.Errorf("couldn't open dest file: %s", err)
} }
defer outputFile.Close() defer outputFile.Close()
_, err = io.Copy(outputFile, inputFile) _, 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 { if err != nil {
return fmt.Errorf("writing to output file failed: %s", err) return fmt.Errorf("writing to output file failed: %s", err)
} }