diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 85a9f82..39563c9 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -181,7 +181,7 @@ type Kind uint64 const ( // KindHTTPGet is the kind of [Artifact] returned by [NewHTTPGet]. KindHTTPGet Kind = iota - // KindTar is the kind of artifact returned by [NewTar]. + // KindTar is the kind of [Artifact] returned by [NewTar]. KindTar ) @@ -829,6 +829,11 @@ func (c *Cache) Cure(a Artifact) ( temp: c.base.Append(dirTemp, ids), } defer func() { + if chmodErr, removeErr := removeAll(cc.temp); chmodErr != nil || removeErr != nil { + err = errors.Join(err, chmodErr, removeErr) + return + } + if err != nil { chmodErr, removeErr := removeAll(cc.work) if chmodErr != nil || removeErr != nil { @@ -844,11 +849,6 @@ func (c *Cache) Cure(a Artifact) ( return } cc.cache = nil - if chmodErr, removeErr := removeAll(cc.temp); chmodErr != nil || removeErr != nil { - err = errors.Join(err, chmodErr, removeErr) - return - } - var fi os.FileInfo if fi, err = os.Lstat(cc.work.String()); err != nil { if errors.Is(err, os.ErrNotExist) {