fix json output

This commit is contained in:
d1slike committed 2020-06-03 13:27:40 +03:00
1 parent b65cda4099
commit 3eeb933231
28 files changed
+180 -595

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ func CheckChangeObject(changeObject string) (string, error) {
}
func PrintAnswer(data interface{}) {
buffer := bytes.NewBuffer(make([]byte, 1024))
buffer := bytes.NewBuffer(make([]byte, 0, 1024))
encoder := json.NewEncoder(buffer)
encoder.SetEscapeHTML(false)
encoder.SetIndent("", " ")
+3 -2
View File
@@ -5,10 +5,11 @@ import (
"isp-ctl/service"
)
func CreateUpdateCommonConfig(stringToChange string, configuration cfg.CommonConfig) {
func CreateUpdateCommonConfig(stringToChange string, configuration cfg.CommonConfig) error {
if answer, err := service.Config.CreateUpdateCommonConfig(stringToChange, configuration); err != nil {
PrintError(err)
return err
} else if answer != nil {
PrintAnswer(answer)
}
return nil
}
+3 -2
View File
@@ -5,10 +5,11 @@ import (
"isp-ctl/service"
)
func CreateUpdateConfig(stringToChange string, configuration *cfg.Config) {
func CreateUpdateConfig(stringToChange string, configuration *cfg.Config) error {
if answer, err := service.Config.CreateUpdateConfig(stringToChange, configuration); err != nil {
PrintError(err)
return err
} else if answer != nil {
PrintAnswer(answer)
}
return nil
}