| 95 | } |
| 96 | |
| 97 | func setNestedValue(meta map[string]any, path []string, value any) { |
| 98 | // For single key, just set directly |
| 99 | if len(path) == 1 { |
| 100 | meta[path[0]] = value |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | // For nested path, traverse or create maps as needed |
| 105 | current := meta |
| 106 | for i := 0; i < len(path)-1; i++ { |
| 107 | key := path[i] |
| 108 | // If next level doesn't exist or isn't a map, create new map |
| 109 | next, exists := current[key] |
| 110 | if !exists { |
| 111 | nextMap := make(map[string]any) |
| 112 | current[key] = nextMap |
| 113 | current = nextMap |
| 114 | } else if nextMap, ok := next.(map[string]any); ok { |
| 115 | current = nextMap |
| 116 | } else { |
| 117 | // If existing value isn't a map, replace with new map |
| 118 | nextMap = make(map[string]any) |
| 119 | current[key] = nextMap |
| 120 | current = nextMap |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // Set the final value |
| 125 | current[path[len(path)-1]] = value |
| 126 | } |
| 127 | |
| 128 | func parseMetaSets(metaSets []string) (map[string]any, error) { |
| 129 | meta := make(map[string]any) |