update file structure [ci skip]

This commit is contained in:
Henrique Dias
2016-03-06 19:18:46 +00:00
parent ddcaccda0c
commit 3f36200862
23 changed files with 180 additions and 165 deletions

30
tools/files/files.go Normal file
View File

@@ -0,0 +1,30 @@
package files
import (
"io"
"os"
)
// CopyFile is used to copy a file
func CopyFile(old, new string) error {
// Open the file and create a new one
r, err := os.Open(old)
if err != nil {
return err
}
defer r.Close()
w, err := os.Create(new)
if err != nil {
return err
}
defer w.Close()
// Copy the content
_, err = io.Copy(w, r)
if err != nil {
return err
}
return nil
}