fix json output
This commit is contained in:
1 parent
b65cda4099
commit
3eeb933231
28 files changed
+180
-595
No files matched your search
@@ -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("", " ")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user