From 6fdd800b2b421b32e7db373b576433126c4652a2 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 4 Mar 2026 17:42:27 +0900 Subject: [PATCH] internal/pkg: check filtered error This avoids filtering some unrelated os.ErrExist. Signed-off-by: Ophestra --- internal/pkg/pkg.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 61ec511..dd48d84 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -163,8 +163,12 @@ func (t *TContext) destroy(errP *error) { if chmodErr != nil || removeErr != nil { *errP = errors.Join(*errP, chmodErr, removeErr) } else if errors.Is(*errP, os.ErrExist) { - // two artifacts may be backed by the same file - *errP = nil + var linkError *os.LinkError + if errors.As(*errP, &linkError) && linkError != nil && + linkError.Op == "rename" { + // two artifacts may be backed by the same file + *errP = nil + } } }