|
@@ -41,7 +41,7 @@ func copyFileContents(src, dst string) (err error) {
|
|
|
}
|
|
|
|
|
|
/*copy the file, ioutile doesn't offer the feature*/
|
|
|
-func CopyFile(sourceSymLink, destinationFile string) (err error) {
|
|
|
+func CopyFile(sourceSymLink, destinationFile string) error {
|
|
|
sourceFile, err := filepath.EvalSymlinks(sourceSymLink)
|
|
|
if err != nil {
|
|
|
log.Infof("Not a symlink : %s", err)
|
|
@@ -51,7 +51,7 @@ func CopyFile(sourceSymLink, destinationFile string) (err error) {
|
|
|
|
|
|
sourceFileStat, err := os.Stat(sourceFile)
|
|
|
if err != nil {
|
|
|
- return
|
|
|
+ return err
|
|
|
}
|
|
|
|
|
|
if !sourceFileStat.Mode().IsRegular() {
|
|
@@ -63,14 +63,14 @@ func CopyFile(sourceSymLink, destinationFile string) (err error) {
|
|
|
destinationFileStat, err := os.Stat(destinationFile)
|
|
|
if err != nil {
|
|
|
if !os.IsNotExist(err) {
|
|
|
- return
|
|
|
+ return err
|
|
|
}
|
|
|
} else {
|
|
|
if !(destinationFileStat.Mode().IsRegular()) {
|
|
|
return fmt.Errorf("copyFile: non-regular destination file %s (%q)", destinationFileStat.Name(), destinationFileStat.Mode().String())
|
|
|
}
|
|
|
if os.SameFile(sourceFileStat, destinationFileStat) {
|
|
|
- return
|
|
|
+ return err
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -78,6 +78,6 @@ func CopyFile(sourceSymLink, destinationFile string) (err error) {
|
|
|
err = copyFileContents(sourceFile, destinationFile)
|
|
|
}
|
|
|
|
|
|
- return
|
|
|
+ return err
|
|
|
}
|
|
|
|