bootdeploy: return errors from writing copy

This commit is contained in:
Clayton Craft
2023-02-19 00:06:36 -08:00
parent c6e79551f4
commit 0545d68b1d

View File

@@ -101,13 +101,19 @@ func bootDeploy(workDir string, outDir string) error {
return nil return nil
} }
// Copy copies the file at srcFile path to a new file at dstFile path
func copy(srcFile, dstFile string) error { func copy(srcFile, dstFile string) error {
out, err := os.Create(dstFile) out, err := os.Create(dstFile)
if err != nil { if err != nil {
return err return err
} }
defer out.Close() defer func() {
errClose := out.Close()
if err == nil {
err = errClose
}
}()
in, err := os.Open(srcFile) in, err := os.Open(srcFile)
if err != nil { if err != nil {