diff --git a/internal/resource.go b/internal/resource.go index 6c7283b..d80a142 100644 --- a/internal/resource.go +++ b/internal/resource.go @@ -92,6 +92,10 @@ func (l *Resource) Download(dir string, mode os.FileMode, ctx context.Context) e // Download file in the target directory so that the call to // os.Rename is atomic. lpath, err := GetUrlToDir(u, dir, ctx) + defer func(path string) { + pathDir := filepath.Dir(path) + os.RemoveAll(pathDir) + }(lpath) if err != nil { break }