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) error
This 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.
In
pkg/common/cliprinter/cliprinter.gothePrintStructmethod causes its arguments to wrapped in a second slice before printing thembecause the internal method is variadic too
This is in contrast to
PrintProtowhich unwraps the args before passing them on (so doesn't wrap them in an extra slice).Its unclear if this is intentional or not.
It caused a problem for me as I was modifying
cmd/spire-server/cli/jwt/mint.goto 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.