diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-08-25 13:57:38 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-08-25 14:00:42 +0900 |
| commit | ac7abbbe3fa2eea01defb670abc7dc1dc336cf21 (patch) | |
| tree | cb8c451110acbd394667e94ae66c53dc422398b8 /cmd/mbf/internal | |
| parent | 7ee5d5368de5494350e7766a595c2bdc8f01ce80 (diff) | |
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>
Diffstat (limited to 'cmd/mbf/internal')
| -rw-r--r-- | cmd/mbf/internal/pkgserver/api.go | 2 | ||||
| -rw-r--r-- | cmd/mbf/internal/pkgserver/api_test.go | 4 | ||||
| -rw-r--r-- | cmd/mbf/internal/pkgserver/index.go | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/cmd/mbf/internal/pkgserver/api.go b/cmd/mbf/internal/pkgserver/api.go index 125be829..68ccd471 100644 --- a/cmd/mbf/internal/pkgserver/api.go +++ b/cmd/mbf/internal/pkgserver/api.go @@ -30,7 +30,7 @@ var ( // handleInfo writes constant system information. func handleInfo(w http.ResponseWriter, _ *http.Request) { infoPayloadOnce.Do(func() { - infoPayload.Count = len(rosa.Native().Collect()) + infoPayload.Count = len(rosa.Collect()) infoPayload.HakureiVersion = info.Version() }) // TODO(mae): cache entire response if no additional fields are planned diff --git a/cmd/mbf/internal/pkgserver/api_test.go b/cmd/mbf/internal/pkgserver/api_test.go index 3a9945da..1552fec9 100644 --- a/cmd/mbf/internal/pkgserver/api_test.go +++ b/cmd/mbf/internal/pkgserver/api_test.go @@ -31,7 +31,7 @@ func TestAPIInfo(t *testing.T) { checkPayload(t, resp, struct { Count int `json:"count"` HakureiVersion string `json:"hakurei_version"` - }{len(rosa.Native().Collect()), info.Version()}) + }{len(rosa.Collect()), info.Version()}) } func TestAPIGet(t *testing.T) { @@ -92,7 +92,7 @@ func TestAPIGet(t *testing.T) { ) }) - count := len(rosa.Native().Collect()) + count := len(rosa.Collect()) t.Run("index", func(t *testing.T) { t.Parallel() checkValidate( diff --git a/cmd/mbf/internal/pkgserver/index.go b/cmd/mbf/internal/pkgserver/index.go index 2cc68f9f..f62a7e73 100644 --- a/cmd/mbf/internal/pkgserver/index.go +++ b/cmd/mbf/internal/pkgserver/index.go @@ -56,12 +56,12 @@ func (index *packageIndex) populate(report *rosa.Report) (err error) { index.handleAccess = report.HandleAccess } - handles := rosa.Native().Collect() + handles := rosa.Collect() work := make([]*metadata, len(handles)) index.names = make(map[string]*metadata) ir := pkg.NewIR() for i, handle := range handles { - meta, a := rosa.Native().Std().MustLoad(handle) + meta, a := rosa.MustLoad(handle) m := metadata{ handle: handle, |
