mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-13 11:55:38 +00:00
fix linter error
This commit is contained in:
parent
7a28531f2f
commit
a9c0ef571c
12
yq.go
12
yq.go
@ -46,18 +46,12 @@ func MoveFile(sourcePath, destPath string) error {
|
|||||||
}
|
}
|
||||||
outputFile, err := os.Create(destPath)
|
outputFile, err := os.Create(destPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = inputFile.Close()
|
defer safelyCloseFile(inputFile)
|
||||||
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 safelyCloseFile(outputFile)
|
||||||
_, err = io.Copy(outputFile, inputFile)
|
_, err = io.Copy(outputFile, inputFile)
|
||||||
err = inputFile.Close()
|
defer safelyCloseFile(inputFile)
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user