mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 08:21:11 +00:00 
			
		
		
		
	Use the standard library function [`os.CopyFS`](https://pkg.go.dev/os#CopyFS) to copy directories. This also should be slightly faster.
		
			
				
	
	
		
			15 lines
		
	
	
	
		
			356 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
	
		
			356 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2022 The Gitea Authors. All rights reserved.
 | 
						|
// SPDX-License-Identifier: MIT
 | 
						|
 | 
						|
package unittest
 | 
						|
 | 
						|
import (
 | 
						|
	"os"
 | 
						|
)
 | 
						|
 | 
						|
// CopyDir copy files recursively from source to target directory.
 | 
						|
//
 | 
						|
// It returns error when error occurs in underlying functions.
 | 
						|
func CopyDir(srcPath, destPath string) error {
 | 
						|
	return os.CopyFS(destPath, os.DirFS(srcPath))
 | 
						|
}
 |