mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Fixes golint errors in pkg/kubecfg
This commit is contained in:
parent
af38bf1ef7
commit
c6b27bb87d
@ -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 {
|
type TemplatePrinter struct {
|
||||||
Template *template.Template
|
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 {
|
func (t *TemplatePrinter) Print(data []byte, w io.Writer) error {
|
||||||
obj, err := api.Decode(data)
|
obj, err := api.Decode(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -249,6 +251,7 @@ func (t *TemplatePrinter) Print(data []byte, w io.Writer) error {
|
|||||||
return t.PrintObj(obj, w)
|
return t.PrintObj(obj, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrintObj formats the obj with the Go Template.
|
||||||
func (t *TemplatePrinter) PrintObj(obj interface{}, w io.Writer) error {
|
func (t *TemplatePrinter) PrintObj(obj interface{}, w io.Writer) error {
|
||||||
return t.Template.Execute(w, obj)
|
return t.Template.Execute(w, obj)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user