func FileCopy(source string, dest string) (err error) {
	sourceFile, err := os.Open(source)
	if err != nil {
		return err
	}
	defer sourceFile.Close()
	destFile, err := os.Create(dest)
	if err != nil {
		return err
	}
	defer destFile.Close()
	_, err = io.Copy(destFile, sourceFile)
	if err == nil {
		si, err := os.Stat(source)
		if err == nil {
			err = os.Chmod(dest, si.Mode())
		}
	}
	return err
}
func FileCopy(source string, dest string) (err error) {
	sourceFile, err := os.Open(source)
	if err != nil {
		return err
	}
	defer sourceFile.Close()
	destFile, err := os.Create(dest)
	if err != nil {
		return err
	}
	defer destFile.Close()
	_, err = io.Copy(destFile, sourceFile)
	if err == nil {
		si, err := os.Stat(source)
		if err == nil {
			err = os.Chmod(dest, si.Mode())
		}
	}
	return err
}
func FileCopy ( source string , dest string ) ( err error ) { sourceFile , err := os . Open ( source ) if err != nil { return err } defer sourceFile . Close ( ) destFile , err := os . Create ( dest ) if err != nil { return err } defer destFile . Close ( ) _ , err = io . Copy ( destFile , sourceFile ) if err == nil { si , err := os . Stat ( source ) if err == nil { err = os . Chmod ( dest , si . Mode ( ) ) } } return err }
// FileCopy copies file source to destination dest.
// Based on Jaybill McCarthy's code which can be found at http://jayblog.jaybill.com/post/id/26
FileCopy copies file source to destination dest . Based on Jaybill McCarthy s code which can be found at http : // jayblog . jaybill . com / post / id / 26