 ee04cfa3f9
			
		
	
	ee04cfa3f9
	
	
	
		
			
			Fix issues with sync.Pool being passed an array and not a pointer. See https://github.com/dominikh/go-tools/blob/master/cmd/staticcheck/docs/checks/SA6002 Add missing tests for content.Copy Fix T.Fatal being called in a goroutine Signed-off-by: Daniel Nephin <dnephin@gmail.com>
		
			
				
	
	
		
			34 lines
		
	
	
		
			602 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			602 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package fs
 | |
| 
 | |
| import (
 | |
| 	"io"
 | |
| 	"os"
 | |
| 
 | |
| 	"github.com/pkg/errors"
 | |
| )
 | |
| 
 | |
| func copyFileInfo(fi os.FileInfo, name string) error {
 | |
| 	if err := os.Chmod(name, fi.Mode()); err != nil {
 | |
| 		return errors.Wrapf(err, "failed to chmod %s", name)
 | |
| 	}
 | |
| 
 | |
| 	// TODO: copy windows specific metadata
 | |
| 
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| func copyFileContent(dst, src *os.File) error {
 | |
| 	buf := bufferPool.Get().(*[]byte)
 | |
| 	_, err := io.CopyBuffer(dst, src, *buf)
 | |
| 	bufferPool.Put(buf)
 | |
| 	return err
 | |
| }
 | |
| 
 | |
| func copyXAttrs(dst, src string) error {
 | |
| 	return nil
 | |
| }
 | |
| 
 | |
| func copyDevice(dst string, fi os.FileInfo) error {
 | |
| 	return errors.New("device copy not supported")
 | |
| }
 |