orEmptyStrings normalizes a nil slice to a non-nil empty slice so the field renders as [] rather than null — matching the legacy orEmptySlice behavior for `to` and `labels`.
(s []string)
| 697 | // field renders as [] rather than null — matching the legacy orEmptySlice |
| 698 | // behavior for `to` and `labels`. |
| 699 | func orEmptyStrings(s []string) []string { |
| 700 | if s == nil { |
| 701 | return []string{} |
| 702 | } |
| 703 | return s |
| 704 | } |
| 705 | |
| 706 | // orEmpty coalesces a nil slice of any element type to an empty slice so the |
| 707 | // JSON renders as [] rather than null (A-3). Pair with `nullable:"false"` on |
no outgoing calls
no test coverage detected