fix: delete workdir recursively

This commit is contained in:
Robert Kaussow 2024-03-14 20:45:00 +01:00
parent 4b5f3e55ad
commit 2187524271
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
1 changed files with 4 additions and 6 deletions

View File

@ -33,7 +33,9 @@ func installPackage(ctx context.Context, client *http.Client, version string, ma
return fmt.Errorf("failed to create tmp dir: %w", err)
}
defer os.RemoveAll(tmpdir)
defer func() {
_ = deleteDir(tmpdir)
}()
log.Debug().
Str("tmpdir", tmpdir).
@ -169,9 +171,5 @@ func sanitizeArchivePath(d, t string) (string, error) {
}
func deleteDir(path string) error {
if _, err := os.Stat(path); os.IsNotExist(err) {
return nil
}
return os.Remove(path)
return os.RemoveAll(path)
}