Skip to content

A nested cell renders as Go's map[runs:3], which nothing downstream can read #751

Closed

Description

@David-Noble-at-work

Feature: #833 — Renderings: the pipeline from result value to stdout

A nested value in a table, csv, or value cell renders in Go's own notation.

health
------
map[runs:3]

Cause

csvCellValue (pkg/result/delimited.go:368) ends in fmt.Sprint(rv.Interface()). For a map or a struct
that yields Go's map[runs:3] or {3 []} -- a rendering that names the language rather than the data, and
that nothing downstream can read. Piping it back into jq is impossible.

It is the same failure PowerShell has with @{runs=3}, and for the same reason: presenting the language's
value instead of the normalized data.

Fix

A non-scalar cell renders as compact JSON -- {"runs":3}, ["a","b"] -- at any depth, never truncated.
Columns stay shallow, and the cell holds the native format, so it pipes back into jq. Flattening to
health.runs remains available through --jq, chosen explicitly.

Types that render themselves are excluded: an error, a fmt.Stringer, an encoding.TextMarshaler. A
time.Time is a struct, and JSON-encoding it would replace the form it defines for itself.

Documented in docs/architecture/10-command-line-interface.md §8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area:CLICommand-line interfaceEpic:CommandLineOne output convention across every CLI in the suitebugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions