Fixes golint errors in pkg/kubecfg

This commit is contained in:
Yuki Yugui Sonoda 2014-07-15 22:54:00 +09:00 committed by Yuki Sonoda (Yugui)
parent af38bf1ef7
commit c6b27bb87d

View File

@ -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)
}