|
|
@@ -255,9 +255,15 @@ func UpdateBroadcastState(values map[string]interface{}) error {
|
|
|
|
|
|
// this allows us to insert stuff into nested structs/keys and not overwrite the existing contents
|
|
|
func recursiveUpdate(dst, src reflect.Value) error {
|
|
|
- if !dst.CanSet() {
|
|
|
- return fmt.Errorf("field (type: %s, kind: %s) is not settable", dst.Type(), dst.Kind())
|
|
|
- }
|
|
|
+ // Check if neither dst nor src are maps or structs (e.g., both are primitive types)
|
|
|
+ if dst.Kind() != reflect.Map && dst.Kind() != reflect.Struct &&
|
|
|
+ src.Kind() != reflect.Map && src.Kind() != reflect.Struct {
|
|
|
+ if dst.Type() != src.Type() {
|
|
|
+ return fmt.Errorf("type mismatch: expected %s, got %s", dst.Type(), src.Type())
|
|
|
+ }
|
|
|
+ dst.Set(src)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
// If dst is a struct and src is a map, handle them field by field
|
|
|
if dst.Kind() == reflect.Struct && src.Kind() == reflect.Map {
|
|
|
for _, key := range src.MapKeys() {
|