From 0fab2e5e89bdbd6b69fe8d0c4d9bfa07e1135642 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Mon, 30 Oct 2017 14:07:58 -0400 Subject: [PATCH] Stop passing encoder/decoder to NewHumanReadablePrinter We only need them if we've got unstructured/unknown data and we want to convert it to typed objects. Signed-off-by: Andy Goldstein --- pkg/cmd/util/output/output.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/util/output/output.go b/pkg/cmd/util/output/output.go index bb2f5a417..61b7e181b 100644 --- a/pkg/cmd/util/output/output.go +++ b/pkg/cmd/util/output/output.go @@ -28,9 +28,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/kubernetes/pkg/printers" - "github.com/heptio/ark/pkg/apis/ark/v1" "github.com/heptio/ark/pkg/cmd/util/flag" - "github.com/heptio/ark/pkg/generated/clientset/versioned/scheme" "github.com/heptio/ark/pkg/util/encode" ) @@ -155,11 +153,6 @@ func printTable(cmd *cobra.Command, obj runtime.Object) (bool, error) { // NewPrinter returns a printer for doing human-readable table printing of // Ark objects. func NewPrinter(cmd *cobra.Command) (*printers.HumanReadablePrinter, error) { - encoder, err := encode.EncoderFor("json") - if err != nil { - return nil, err - } - options := printers.PrintOptions{ NoHeaders: flag.GetOptionalBoolFlag(cmd, "no-headers"), ShowLabels: GetShowLabelsValue(cmd), @@ -167,8 +160,8 @@ func NewPrinter(cmd *cobra.Command) (*printers.HumanReadablePrinter, error) { } printer := printers.NewHumanReadablePrinter( - encoder, - scheme.Codecs.UniversalDecoder(v1.SchemeGroupVersion), + nil, // encoder, only needed if we want/need to convert unstructured/unknown to typed objects + nil, // decoder, only needed if we want/need to convert unstructured/unknown to typed objects options, )