use marshalindent instead of marshal

Signed-off-by: Xu Yang <xyang@ciq.com>
This commit is contained in:
Xu Yang
2024-03-19 03:04:20 -06:00
parent 16183e603c
commit 5956f2e9a1
2 changed files with 2 additions and 2 deletions

View File

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

View File

@@ -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,