Skip to content

An empty Starlark list in a command result marshals as null, not [] #825

Open

Description

@David-Noble-at-work

goValue in cmd/star/star/result.go converts a Starlark list to a Go slice. An empty list
becomes a nil slice, which encoding/json marshals as null, not [].

Observed

A row built in Starlark as {"faults": []} renders under -o json as "faults": null. A consumer
doing .faults | length in jq gets 0 either way, but one testing .faults == [] or iterating in a
typed language sees a different value than the script produced. The same value from
Get-EpicReport's jq is [].

Fix

Allocate with make([]any, 0, n) rather than a nil var, so the empty case marshals as []. Same
for an empty dict, if it has the same shape ({} vs null).

Observed under noblefactor-ops#140 Phase 1.

Activity

  1. David-Noble-at-work commented on Nov 9, 2026

    @David-Noble-at-work
    ContributorAuthor

    star github triage sweep added this issue to Triage: devlore, for the rules it breaks:

    • severity: a Bug whose Severity is blank; a bug is Critical, High, Medium or Low
    • no-evidence: no Evidence of completion section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions