From ce98428cbe0bd27829752a6a3c8e9aed1899f4b8 Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Tue, 12 Apr 2022 11:41:31 +0300 Subject: [PATCH] rename var --- utils/utils.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 2a57e8b..4a573f2 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -102,44 +102,44 @@ func ValidatePost(title, text string, files []*multipart.FileHeader) string { } func ValidatePost2(title, text string, files []*multipart.FileHeader) *repositories.Inputs { - validationError := new(repositories.Inputs) + validationErrors := new(repositories.Inputs) hasErrors := false if text == "" && len(files) == 0 { - validationError.Text = repositories.InvalidTextOrFilesErrorMessage - validationError.Files = repositories.InvalidTextOrFilesErrorMessage + validationErrors.Text = repositories.InvalidTextOrFilesErrorMessage + validationErrors.Files = repositories.InvalidTextOrFilesErrorMessage hasErrors = true } if len([]rune(title)) > 100 { - validationError.Title = repositories.InvalidTitleLengthErrorMessage + validationErrors.Title = repositories.InvalidTitleLengthErrorMessage hasErrors = true } if len([]rune(text)) > 1000 { - validationError.Text = repositories.InvalidTextLengthErrorMessage + validationErrors.Text = repositories.InvalidTextLengthErrorMessage hasErrors = true } if len(files) > 4 { - validationError.Files = repositories.InvalidFilesLengthErrorMessage + validationErrors.Files = repositories.InvalidFilesLengthErrorMessage hasErrors = true } isFilesExtsValid := CheckFilesExt(files) if !isFilesExtsValid { - validationError.Files = repositories.InvalidFileExtErrorMessage + validationErrors.Files = repositories.InvalidFileExtErrorMessage hasErrors = true } isFilesSizesNotToBig := CheckFilesSize(files) if !isFilesSizesNotToBig { - validationError.Files = repositories.InvalidFileSizeErrorMessage + validationErrors.Files = repositories.InvalidFileSizeErrorMessage hasErrors = true } if hasErrors { - return validationError + return validationErrors } return nil