From c6b27bb87d5336ef284315d0f5272b49743345f9 Mon Sep 17 00:00:00 2001 From: Yuki Yugui Sonoda Date: Tue, 15 Jul 2014 22:54:00 +0900 Subject: [PATCH] Fixes golint errors in pkg/kubecfg --- pkg/kubecfg/resource_printer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/kubecfg/resource_printer.go b/pkg/kubecfg/resource_printer.go index 39864f75859..52e26278fdc 100644 --- a/pkg/kubecfg/resource_printer.go +++ b/pkg/kubecfg/resource_printer.go @@ -237,10 +237,12 @@ func (h *HumanReadablePrinter) PrintObj(obj interface{}, output io.Writer) error } } +// TemplatePrinter is an implementation of ResourcePrinter which formats data with a Go Template. type TemplatePrinter struct { Template *template.Template } +// Print parses the data as JSON, and re-formats it with the Go Template. func (t *TemplatePrinter) Print(data []byte, w io.Writer) error { obj, err := api.Decode(data) if err != nil { @@ -249,6 +251,7 @@ func (t *TemplatePrinter) Print(data []byte, w io.Writer) error { return t.PrintObj(obj, w) } +// PrintObj formats the obj with the Go Template. func (t *TemplatePrinter) PrintObj(obj interface{}, w io.Writer) error { return t.Template.Execute(w, obj) }