优化代码

This commit is contained in:
GoEdgeLab
2021-12-14 10:01:21 +08:00
parent 5a19e849fd
commit 9a7e1102d5
3 changed files with 21 additions and 11 deletions

View File

@@ -95,16 +95,11 @@ func main() {
if err != nil {
fmt.Println("[ERROR]" + err.Error())
} else {
instances, ok := reply.Params["result"]
if ok {
instancesJSON, err := json.MarshalIndent(instances, "", " ")
if err != nil {
fmt.Println("[ERROR]" + err.Error())
} else {
fmt.Println(string(instancesJSON))
}
instancesJSON, err := json.MarshalIndent(reply.Params, "", " ")
if err != nil {
fmt.Println("[ERROR]" + err.Error())
} else {
fmt.Println("no instances yet.")
fmt.Println(string(instancesJSON))
}
}
})