file copying how does it work

This commit is contained in:
Mark McGranaghan 2012-10-09 13:02:10 -07:00
parent a8fd1a1c40
commit 367cf27324

View File

@ -29,12 +29,10 @@ func ensureDir(dir string) {
} }
func copyFile(src, dst string) { func copyFile(src, dst string) {
srcF, err := os.Open(src, os.O_RDONLY, 0) txt := mustReadFile(src)
check(err)
dstF, err := os.Create(dst) dstF, err := os.Create(dst)
check(err) check(err)
err = io.Copy(srcF, dstF) fmt.Fprint(dstF, txt)
check(err)
} }
func pipe(bin string, arg []string, src string) []byte { func pipe(bin string, arg []string, src string) []byte {