forked from rosa/hakurei
internal/rosa: read-only access to built-ins
This removes potential footguns caused by mutable builtins without requiring unnecessary clones. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
+3
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user