ЛР 5: асинхронная обработка изображений, уровень 5

This commit is contained in:
Nurlygayanova Ekaterina
2026-11-12 20:32:55 +03:00
parent 276dbdad8a
commit 7b3eab5473
115 changed files with 8847 additions and 34 deletions
+14
View File
@@ -0,0 +1,14 @@
package validate
import "fmt"
// MessageText: пустой или пробельный текст допустим, только если у сообщения есть вложения.
func MessageText(s string, hasAttachments bool) error {
if !hasAttachments && !notOnlyWhitespace(s) {
return newError("text", "must not be empty or whitespace only")
}
if !codePointsBetween(s, 0, MessageTextMaxLen) {
return newError("text", fmt.Sprintf("length must be at most %d code points", MessageTextMaxLen))
}
return nil
}