From 338f9cf78c831c5572151e3a876a81e6ced9f4de Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Thu, 14 Mar 2024 19:45:02 -0600 Subject: [PATCH] return JSON results in slice instead of table Signed-off-by: Meredith Lancaster --- pkg/cmd/attestation/inspect/inspect.go | 7 +------ pkg/cmd/attestation/verify/verify.go | 6 +----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/pkg/cmd/attestation/inspect/inspect.go b/pkg/cmd/attestation/inspect/inspect.go index 0b028de7b..abf5eb7fd 100644 --- a/pkg/cmd/attestation/inspect/inspect.go +++ b/pkg/cmd/attestation/inspect/inspect.go @@ -143,12 +143,7 @@ func runInspect(opts *Options) error { jsonResults[i] = string(jsonBytes) } - rows := make([][]string, 1) - rows[0] = jsonResults - if err = opts.Logger.PrintTableToStdOut(nil, rows); err != nil { - return fmt.Errorf("failed to print output as JSON: %w", err) - } - + fmt.Fprintf(opts.Logger.IO.Out, "%v", jsonResults) return nil } diff --git a/pkg/cmd/attestation/verify/verify.go b/pkg/cmd/attestation/verify/verify.go index 1b0c81bb8..227f8ea5c 100644 --- a/pkg/cmd/attestation/verify/verify.go +++ b/pkg/cmd/attestation/verify/verify.go @@ -208,11 +208,7 @@ func runVerify(opts *Options) error { jsonResults[i] = string(jsonBytes) } - rows := make([][]string, 1) - rows[0] = jsonResults - if err := opts.Logger.PrintTableToStdOut(nil, rows); err != nil { - return fmt.Errorf("failed to print JSON output") - } + fmt.Fprintf(opts.Logger.IO.Out, "%v", jsonResults) } // All attestations passed verification and policy evaluation