Make test data - ensure you've Chdir'ed into a temp dir first Returns list of files/dirs that are created First entry is the parent dir of all others
(smallFolder, largeFolder int)
| 211 | // Returns list of files/dirs that are created |
| 212 | // First entry is the parent dir of all others |
| 213 | func createFastWalkInputData(smallFolder, largeFolder int) []string { |
| 214 | dirs := []string{ |
| 215 | "testroot", |
| 216 | "testroot/folder1", |
| 217 | "testroot/folder2", |
| 218 | "testroot/folder2/subfolder1", |
| 219 | "testroot/folder2/subfolder2", |
| 220 | "testroot/folder2/subfolder3", |
| 221 | "testroot/folder2/subfolder4", |
| 222 | "testroot/folder2/subfolder4/subsub", |
| 223 | } |
| 224 | expectedEntries := make([]string, 0, 250) |
| 225 | |
| 226 | for i, dir := range dirs { |
| 227 | os.MkdirAll(dir, 0755) |
| 228 | numFiles := smallFolder |
| 229 | expectedEntries = append(expectedEntries, dir) |
| 230 | if i >= 3 && i <= 5 { |
| 231 | // Bulk test to ensure works with > 1 batch |
| 232 | numFiles = largeFolder |
| 233 | } |
| 234 | for f := 0; f < numFiles; f++ { |
| 235 | filename := join(dir, fmt.Sprintf("file%d.txt", f)) |
| 236 | os.WriteFile(filename, []byte("TEST"), 0644) |
| 237 | expectedEntries = append(expectedEntries, filename) |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | return expectedEntries |
| 242 | } |
| 243 | |
| 244 | func collectFastWalkResults(fchan <-chan fastWalkInfo) ([]string, []error) { |
| 245 | gotEntries := make([]string, 0, 1000) |
no test coverage detected