diff --git a/cmd/data_setIntent.go b/cmd/data_setIntent.go index 869b971..f533b55 100644 --- a/cmd/data_setIntent.go +++ b/cmd/data_setIntent.go @@ -38,9 +38,8 @@ var dataSetIntentCmd = &cobra.Command{ req.Delete = true } if intentDefinition != "" { - intentDefs := make([]*intentDef, 0) - err := utils.JsonUnmarshalStrict(intentDefinition, intentDefs) + err := utils.JsonUnmarshalStrict(intentDefinition, &intentDefs) if err != nil { return err } diff --git a/pkg/utils/json.go b/pkg/utils/json.go index cc85d00..eff3ea1 100644 --- a/pkg/utils/json.go +++ b/pkg/utils/json.go @@ -5,7 +5,7 @@ import ( "os" ) -func JsonUnmarshalStrict(file string, strukt interface{}) error { +func JsonUnmarshalStrict(file string, obj interface{}) error { // open the file f, err := os.Open(file) if err != nil { @@ -16,7 +16,7 @@ func JsonUnmarshalStrict(file string, strukt interface{}) error { // enable strict parsing decoder.DisallowUnknownFields() // unmarshall - err = decoder.Decode(strukt) + err = decoder.Decode(obj) if err != nil { return err }