(text *string, typ string)
| 263 | } |
| 264 | |
| 265 | func sanitizeLabelText(text *string, typ string) error { |
| 266 | if text == nil { |
| 267 | return nil |
| 268 | } |
| 269 | |
| 270 | *text = strings.TrimSpace(*text) |
| 271 | |
| 272 | if len(*text) == 0 { |
| 273 | return errors.InvalidArgument("%s must be a non-empty string", typ) |
| 274 | } |
| 275 | |
| 276 | if utf8.RuneCountInString(*text) > maxLabelLength { |
| 277 | return errors.InvalidArgument("%s can have at most %d characters", typ, maxLabelLength) |
| 278 | } |
| 279 | |
| 280 | for _, ch := range *text { |
| 281 | if unicode.IsControl(ch) { |
| 282 | return errors.InvalidArgument("%s cannot contain control characters", typ) |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | return nil |
| 287 | } |
| 288 | |
| 289 | func sanitizeDescription(description *string) { |
| 290 | if description == nil { |
no test coverage detected
searching dependent graphs…