mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #33686 from ymqytw/format_json_printer_for_runtime.Unknown
Automatic merge from submit-queue formatting json printer for runtime.Unknown Formatting JSONPrinter. It prints everything in one single line before. Now it prints in well-formatted way.
This commit is contained in:
commit
f9dd76564c
@ -275,7 +275,13 @@ func (p *JSONPrinter) AfterPrint(w io.Writer, res string) error {
|
|||||||
func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
||||||
switch obj := obj.(type) {
|
switch obj := obj.(type) {
|
||||||
case *runtime.Unknown:
|
case *runtime.Unknown:
|
||||||
_, err := w.Write(obj.Raw)
|
var buf bytes.Buffer
|
||||||
|
err := json.Indent(&buf, obj.Raw, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
buf.WriteRune('\n')
|
||||||
|
_, err = buf.WriteTo(w)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user