internal/rosa: read-only access to built-ins
Test / Create distribution (push) Successful in 30s
Test / ShareFS (push) Successful in 36s
Test / Sandbox (race detector) (push) Successful in 39s
Test / Hakurei (push) Successful in 43s
Test / Sandbox (push) Successful in 44s
Test / Hakurei (race detector) (push) Successful in 49s
Test / Flake checks (push) Successful in 1m20s

This removes potential footguns caused by mutable builtins without requiring unnecessary clones.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
cat
2026-08-25 14:00:42 +09:00
parent 7ee5d5368d
commit ac7abbbe3f
16 changed files with 123 additions and 94 deletions
+3 -4
View File
@@ -21,7 +21,7 @@ func commandInfo(
r *rosa.Report,
) (err error) {
if len(args) == 0 {
for _, h := range rosa.Native().CollectAll() {
for _, h := range rosa.CollectAll() {
fmt.Println(h)
}
return nil
@@ -39,10 +39,9 @@ func commandInfo(
}
}
t := rosa.Native().Std()
for i, name := range args {
handle := rosa.ArtifactH(unique.Make(name))
if meta, a := t.Load(handle); meta == nil {
if meta, a := rosa.Load(handle); meta == nil {
return fmt.Errorf("unknown artifact %q", name)
} else {
var suffix string
@@ -60,7 +59,7 @@ func commandInfo(
if len(meta.Dependencies) > 0 {
mustPrint("depends on :")
for _, d := range meta.Dependencies {
_meta, _ := rosa.Native().Std().MustLoad(d)
_meta, _ := rosa.MustLoad(d)
s := _meta.Name
if _meta.Version != rosa.Unversioned {
s += "-" + _meta.Version