ValidateNoControlChars rejects identifier-like inputs containing control characters, which are easy to miss in automation and should never be valid.
(field, value string)
| 7 | // ValidateNoControlChars rejects identifier-like inputs containing control |
| 8 | // characters, which are easy to miss in automation and should never be valid. |
| 9 | func ValidateNoControlChars(field, value string) error { |
| 10 | for _, r := range value { |
| 11 | if unicode.IsControl(r) { |
| 12 | return FlagErrorf("%s must not contain control characters", field) |
| 13 | } |
| 14 | } |
| 15 | return nil |
| 16 | } |
no test coverage detected