From 52cde35aea13b493471084bce7f1a48d62cca9a9 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Tue, 16 Jun 2026 19:38:00 +0200 Subject: [PATCH] try deleting a directory before resetting the readonly status in tests --- internal/test/helpers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/test/helpers.go b/internal/test/helpers.go index 1ca5c151a..48fbf1259 100644 --- a/internal/test/helpers.go +++ b/internal/test/helpers.go @@ -195,8 +195,12 @@ func resetReadOnly(t testing.TB, dir string) { // afterwards uses os.RemoveAll() to remove the path. func RemoveAll(t testing.TB, path string) { t.Helper() - resetReadOnly(t, path) - err := os.RemoveAll(path) + var err error + err = os.RemoveAll(path) + if err != nil { + resetReadOnly(t, path) + err = os.RemoveAll(path) + } if errors.Is(err, os.ErrNotExist) { err = nil }