func copyFile(src, dst string) error {
	s, err := os.Open(src)
	if err != nil {
		return err
	}
	defer s.Close()

	stat, err := s.Stat()
	if err != nil {
		return err
	}

	d, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, stat.Mode())
	if err != nil {
		return err
	}
	if _, err := io.Copy(d, s); err != nil {
		d.Close()
		return err
	}
	if err := d.Close(); err != nil {
		return err
	}

	// io.Copy can restrict file permissions based on umask.
	return os.Chmod(dst, stat.Mode())
}
func copyFile(src, dst string) error {
	s, err := os.Open(src)
	if err != nil {
		return err
	}
	defer s.Close()

	stat, err := s.Stat()
	if err != nil {
		return err
	}

	d, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, stat.Mode())
	if err != nil {
		return err
	}
	if _, err := io.Copy(d, s); err != nil {
		d.Close()
		return err
	}
	if err := d.Close(); err != nil {
		return err
	}

	
	return os.Chmod(dst, stat.Mode())
}
func copyFile ( src , dst string ) error { s , err := os . Open ( src ) if err != nil { return err } defer s . Close ( ) stat , err := s . Stat ( ) if err != nil { return err } d , err := os . OpenFile ( dst , os . O_WRONLY | os . O_CREATE | os . O_TRUNC , stat . Mode ( ) ) if err != nil { return err } if _ , err := io . Copy ( d , s ) ; err != nil { d . Close ( ) return err } if err := d . Close ( ) ; err != nil { return err } // io.Copy can restrict file permissions based on umask. return os . Chmod ( dst , stat . Mode ( ) ) }
// copyFile copies the file at src to the path at dst. Any errors that occur
// are returned.
copyFile copies the file at src to the path at dst . Any errors that occur are returned .