MCPcopy
hub / github.com/syncthing/syncthing / removeAll

Function removeAll

test/util.go:282–303  ·  view source on GitHub ↗

rm -rf

(dirs ...string)

Source from the content-addressed store, hash-verified

280
281// rm -rf
282func removeAll(dirs ...string) error {
283 for _, dir := range dirs {
284 files, err := filepath.Glob(dir)
285 if err != nil {
286 return err
287 }
288 for _, file := range files {
289 // Set any non-writeable files and dirs to writeable. This is necessary for os.RemoveAll to work on Windows.
290 filepath.Walk(file, func(path string, info os.FileInfo, err error) error {
291 if err != nil {
292 return err
293 }
294 if info.Mode()&0o700 != 0o700 {
295 os.Chmod(path, 0o777)
296 }
297 return nil
298 })
299 os.RemoveAll(file)
300 }
301 }
302 return nil
303}
304
305// Compare a number of directories. Returns nil if the contents are identical,
306// otherwise an error describing the first found difference.

Callers 15

testSymlinksFunction · 0.85
TestRescanWithDelayFunction · 0.85
testFileTypeChangeFunction · 0.85
cleanBenchmarkTransferFunction · 0.85
TestScanSubdirFunction · 0.85
TestResetFunction · 0.85
TestConflictsDefaultFunction · 0.85
TestConflictsIndexResetFunction · 0.85
TestConflictsSameContentFunction · 0.85
TestManyPeersFunction · 0.85

Calls 5

GlobMethod · 0.65
WalkMethod · 0.65
ModeMethod · 0.65
ChmodMethod · 0.65
RemoveAllMethod · 0.65

Tested by 15

testSymlinksFunction · 0.68
TestRescanWithDelayFunction · 0.68
testFileTypeChangeFunction · 0.68
cleanBenchmarkTransferFunction · 0.68
TestScanSubdirFunction · 0.68
TestResetFunction · 0.68
TestConflictsDefaultFunction · 0.68
TestConflictsIndexResetFunction · 0.68
TestConflictsSameContentFunction · 0.68
TestManyPeersFunction · 0.68