internal/pkg: deduplicate dependency errors

This significantly simplifies error reporting for caller.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-17 14:16:29 +09:00
parent 610ee13ab3
commit efc90c3221
3 changed files with 177 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ import (
"os/exec"
"slices"
"testing"
"unique"
"hakurei.app/container/check"
"hakurei.app/container/stub"
@@ -74,7 +75,14 @@ func TestExec(t *testing.T) {
return stub.UniqueError(0xcafe)
},
}),
), nil, pkg.Checksum{}, errors.Join(stub.UniqueError(0xcafe))},
), nil, pkg.Checksum{}, &pkg.DependencyCureError{
{
Ident: unique.Make(pkg.ID(pkg.MustDecode(
"CWEoJqnSBpWf8uryC2qnIe3O1a_FZWUWZGbiVPsQFGW7pvDHiSwoK3QCU9-uxN87",
))),
Err: stub.UniqueError(0xcafe),
},
}},
{"invalid paths", pkg.NewExec(
"", nil, 0,