From 5956f2e9a1871c923eab2db830ff7dba14c3b83a Mon Sep 17 00:00:00 2001 From: Xu Yang Date: Tue, 19 Mar 2024 03:04:20 -0600 Subject: [PATCH] use marshalindent instead of marshal Signed-off-by: Xu Yang --- internal/pkg/api/node/list.go | 2 +- internal/pkg/api/profile/list.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/pkg/api/node/list.go b/internal/pkg/api/node/list.go index e19bd1a5..2ffa66d2 100644 --- a/internal/pkg/api/node/list.go +++ b/internal/pkg/api/node/list.go @@ -114,7 +114,7 @@ func NodeList(nodeGet *wwapiv1.GetNodeList) (nodeList wwapiv1.NodeList, err erro var buf []byte if nodeGet.Type == wwapiv1.GetNodeList_JSON { - buf, _ = json.Marshal(nodeResp) + buf, _ = json.MarshalIndent(nodeResp, "", " ") } if nodeGet.Type == wwapiv1.GetNodeList_YAML { buf, _ = yaml.Marshal(nodeResp) diff --git a/internal/pkg/api/profile/list.go b/internal/pkg/api/profile/list.go index 697ef8a3..0d833573 100644 --- a/internal/pkg/api/profile/list.go +++ b/internal/pkg/api/profile/list.go @@ -55,7 +55,7 @@ func ProfileList(ShowOpt *wwapiv1.GetProfileList) (profileList wwapiv1.ProfileLi profileMap[profile.Id.Get()] = profile } - buf, _ := json.Marshal(profileMap) + buf, _ := json.MarshalIndent(profileMap, "", " ") profileList.Output = append(profileList.Output, string(buf)) } else { profileList.Output = append(profileList.Output,