(m map[string]string)
| 125 | } |
| 126 | |
| 127 | func buildStruct(m map[string]string) *structpb.Struct { |
| 128 | if m == nil { |
| 129 | return nil |
| 130 | } |
| 131 | anyMap := make(map[string]any, len(m)) |
| 132 | for k, v := range m { |
| 133 | anyMap[k] = v |
| 134 | } |
| 135 | pb, err := structpb.NewStruct(anyMap) |
| 136 | if err != nil { |
| 137 | // Acceptable to panic because there are no unknown types, so this should never happen. |
| 138 | panic(fmt.Errorf("failed to build struct: %w", err)) |
| 139 | } |
| 140 | return pb |
| 141 | } |