describeJSON names the kind of a decoded JSON value for messages.
(v any)
| 239 | |
| 240 | // describeJSON names the kind of a decoded JSON value for messages. |
| 241 | func describeJSON(v any) string { |
| 242 | switch v.(type) { |
| 243 | case nil: |
| 244 | return "null" |
| 245 | case string: |
| 246 | return "a string" |
| 247 | case json.Number, float64: |
| 248 | return "a number" |
| 249 | case bool: |
| 250 | return "a boolean" |
| 251 | case []any: |
| 252 | return "a list" |
| 253 | case map[string]any: |
| 254 | return "an object" |
| 255 | default: |
| 256 | return fmt.Sprintf("%T", v) |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | // listNames joins names for messages, shortening long lists. |
| 261 | func listNames(names []string, limit int) string { |
no outgoing calls
no test coverage detected