package helpers

import (
	"io"
	"os"
)

// Copyfile takes a source and destination file path and copies the file. Destination needs to be complete path of file, not a directory
func CopyFile(srcPath, destPath string) (err error) {
	// open files r and w
	r, err := os.Open(srcPath)
	if err != nil {
		return err
	}
	defer r.Close()

	w, err := os.Create(destPath)
	if err != nil {
		return err
	}
	defer w.Close()

	// do the actual work
	n, err := io.Copy(w, r) // <------ here !
	if err != nil {
		return err
	}

	// fmt.Printf("Copied %v bytes\n", n)
	return nil
}

package helpers

import (
	"io"
	"os"
)

// Copyfile takes a source and destination file path and copies the file. Destination needs to be complete path of file, not a directory
func CopyFile(srcPath, destPath string) (err error) {
	// open files r and w
	r, err := os.Open(srcPath)
	if err != nil {
		return err
	}
	defer r.Close()

	w, err := os.Create(destPath)
	if err != nil {
		return err
	}
	defer w.Close()

	// do the actual work
	_, err = io.Copy(w, r) // <------ here !
	if err != nil {
		return err
	}

	// fmt.Printf("Copied %v bytes\n", n)
	return nil
}

Remove update line in copy file
Remove update line in copy file

Signed-off-by: Matt Stratton <39982728c5a806c113d54b69a3f65ecf65602e8a@gmail.com>
