diff --git a/cfg/domain.go b/cfg/domain.go index 79f4c6e..565e726 100644 --- a/cfg/domain.go +++ b/cfg/domain.go @@ -24,7 +24,7 @@ type Config struct { ModuleId string Version int32 Active bool - Data map[string]interface{} + Data map[string]any Unsafe bool } @@ -34,7 +34,7 @@ type CommonConfig struct { Description string CreatedAt time.Time UpdatedAt time.Time - Data map[string]interface{} + Data map[string]any } type Connection struct { diff --git a/command/schema.go b/command/schema.go index 80920b9..0157e76 100644 --- a/command/schema.go +++ b/command/schema.go @@ -36,7 +36,7 @@ func (s schemaCommand) action(ctx *cli.Context) error { moduleName := ctx.Args().First() if schemaConfig := s.getSchemaConfig(moduleName); schemaConfig != nil { - schema := make(map[string]interface{}) + schema := make(map[string]any) schema["title"] = moduleName schema["schema"] = schemaConfig switch ctx.String(flag.OutPrintSchema.Name) { @@ -51,7 +51,7 @@ func (s schemaCommand) action(ctx *cli.Context) error { return nil } -func (s schemaCommand) getSchemaConfig(moduleName string) interface{} { +func (s schemaCommand) getSchemaConfig(moduleName string) any { if configuration, err := service.Config.GetConfigurationByModuleName(moduleName); err != nil { utils.PrintError(err) return nil @@ -63,7 +63,7 @@ func (s schemaCommand) getSchemaConfig(moduleName string) interface{} { } } -func (s schemaCommand) printHtml(schema map[string]interface{}) { +func (s schemaCommand) printHtml(schema map[string]any) { if temp, err := template.New("template").Parse(tmpl.HtmlFile); err != nil { utils.PrintError(err) return diff --git a/command/utils/common.go b/command/utils/common.go index 1625213..1447149 100644 --- a/command/utils/common.go +++ b/command/utils/common.go @@ -45,7 +45,7 @@ func CheckChangeObject(changeObject string) (string, error) { } } -func PrintAnswer(data interface{}) { +func PrintAnswer(data any) { encoder := json.NewEncoder(os.Stdout) encoder.SetEscapeHTML(false) encoder.SetIndent("", " ") @@ -59,7 +59,7 @@ func PrintError(err error) { os.Exit(-1) } -func ParseSetObject(argument string) interface{} { +func ParseSetObject(argument string) any { tryParse := []byte(argument) if tryParse[0] == '"' && tryParse[len(tryParse)-1] == '"' { tryParse = tryParse[1 : len(tryParse)-1] @@ -70,12 +70,12 @@ func ParseSetObject(argument string) interface{} { return nil } - mapStringInterface := make(map[string]interface{}) + mapStringInterface := make(map[string]any) if err := json.Unmarshal(tryParse, &mapStringInterface); err == nil { return mapStringInterface } - arrayOfObject := make([]interface{}, 0) + arrayOfObject := make([]any, 0) if err := json.Unmarshal(tryParse, &arrayOfObject); err == nil { return arrayOfObject } @@ -103,7 +103,7 @@ func CheckObject(jsonObject []byte, depth string) { if jsonString.Raw == "" { PrintError(errors.Errorf("path '%s' not found\n", depth)) } else { - var data interface{} + var data any if err := json.Unmarshal([]byte(jsonString.Raw), &data); err != nil { PrintError(err) } else { diff --git a/command/utils/config.go b/command/utils/config.go index ef699d4..74837c6 100644 --- a/command/utils/config.go +++ b/command/utils/config.go @@ -6,7 +6,8 @@ import ( ) func CreateUpdateConfig(stringToChange string, configuration *cfg.Config) error { - if answer, err := service.Config.CreateUpdateConfig(stringToChange, configuration); err != nil { + answer, err := service.Config.CreateUpdateConfig(stringToChange, configuration) + if err != nil { return err } else if answer != nil { PrintAnswer(answer)