-
Notifications
You must be signed in to change notification settings - Fork 600
All CLI JSON output is wrapped in a slice of one item #6654
Copy link
Copy link
Open
Labels
priority/backlogIssue is approved and in the backlogIssue is approved and in the backlog
Milestone
Description
In pkg/common/cliprinter/cliprinter.go the PrintStruct method causes its arguments to wrapped in a second slice before printing them
func (p *printer) PrintStruct(msg ...any) error {
return p.printStruct(msg)
}because the internal method is variadic too
func (p *printer) printStruct(msg ...any) errorThis is in contrast to PrintProto which unwraps the args before passing them on (so doesn't wrap them in an extra slice).
func (p *printer) PrintProto(msg ...proto.Message) error {
return p.printProto(msg...)
}Its unclear if this is intentional or not.
It caused a problem for me as I was modifying cmd/spire-server/cli/jwt/mint.go to support giving output conforming to https://kubernetes.io/docs/reference/config-api/client-authentication.v1/#client-authentication-k8s-io-v1-ExecCredentialStatus - but could not with the cliprinter as is because any json output was wrapped as an array of one item.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority/backlogIssue is approved and in the backlogIssue is approved and in the backlog