TempDirClone creates a new temporary directory copy from the provided directory path. It is the caller's responsibility to call `os.RemoveAll(tempDir)` when the directory is no longer needed!
(dirToClone string)
| 814 | // It is the caller's responsibility to call `os.RemoveAll(tempDir)` |
| 815 | // when the directory is no longer needed! |
| 816 | func TempDirClone(dirToClone string) (string, error) { |
| 817 | tempDir, err := os.MkdirTemp("", "pb_test_*") |
| 818 | if err != nil { |
| 819 | return "", err |
| 820 | } |
| 821 | |
| 822 | // copy everything from testDataDir to tempDir |
| 823 | if err := copyDir(dirToClone, tempDir); err != nil { |
| 824 | return "", err |
| 825 | } |
| 826 | |
| 827 | return tempDir, nil |
| 828 | } |
| 829 | |
| 830 | // ------------------------------------------------------------------- |
| 831 | // Helpers |
no test coverage detected
searching dependent graphs…