(m map[string]interface{})
| 154 | } |
| 155 | |
| 156 | func mapToBasicMap(m map[string]interface{}) map[string]interface{} { |
| 157 | basic := make(map[string]interface{}, len(m)) |
| 158 | for k, v := range m { |
| 159 | var val interface{} = v |
| 160 | switch v := v.(type) { |
| 161 | case float32: |
| 162 | val = float64(v) |
| 163 | case int: |
| 164 | val = int64(v) |
| 165 | case []int: |
| 166 | i64Slice := make([]int64, len(v)) |
| 167 | for i, v := range v { |
| 168 | i64Slice[i] = int64(v) |
| 169 | } |
| 170 | val = i64Slice |
| 171 | case int8: |
| 172 | val = int64(v) |
| 173 | case int16: |
| 174 | val = int64(v) |
| 175 | case int32: |
| 176 | val = int64(v) |
| 177 | case uint: |
| 178 | // #nosec G115 - Safe conversion for test data |
| 179 | val = int64(v) |
| 180 | case uint8: |
| 181 | val = int64(v) |
| 182 | case uint16: |
| 183 | val = int64(v) |
| 184 | case uint32: |
| 185 | val = int64(v) |
| 186 | case uint64: |
| 187 | // #nosec G115 - Safe conversion for test data with small test values |
| 188 | val = int64(v) |
| 189 | case time.Duration: |
| 190 | val = v.String() |
| 191 | case time.Time: |
| 192 | val = v.Format(time.RFC3339Nano) |
| 193 | case fmt.Stringer: |
| 194 | val = v.String() |
| 195 | } |
| 196 | |
| 197 | basic[k] = val |
| 198 | } |
| 199 | |
| 200 | return basic |
| 201 | } |
| 202 | |
| 203 | func attributesToMap(attrs []attribute.KeyValue) map[string]interface{} { |
| 204 | m := make(map[string]interface{}, len(attrs)) |
no test coverage detected