Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-28 04:36:11 +01:00
forgejo/models/unittest/fscopy.go
Gusted cdf3636ae7
chore: simplify CopyDir
Use the standard library function [`os.CopyFS`](https://pkg.go.dev/os#CopyFS) to copy directories.
This also should be slightly faster.
2024-11-10 17:21:57 +01:00

16 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))
}