fix linter error

This commit is contained in:
Aleksandr Sergin 2019-08-23 20:06:15 +03:00 committed by Mike Farah
parent 7a28531f2f
commit a9c0ef571c

12
yq.go
View File

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