Skip to content
Snippets Groups Projects
Commit d7fbac07 authored by ko_oler's avatar ko_oler
Browse files

fix

parent a7dc12a0
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,8 @@ func GenerateNewID() string {
}
func ValidateID(id *string) error {
trimmedID := strings.TrimSpace(*id)
trimmedID := *id
trimmedID = strings.TrimSpace(trimmedID)
if trimmedID == "" {
return ErrEmptyID
}
......@@ -37,18 +38,19 @@ func ValidateID(id *string) error {
if !isValidID(trimmedID) {
return errors.WithDetail(ErrNotValidID, "must begin with latin letters and contain latin letters, numbers or '-', '_'")
}
*id = trimmedID
return nil
}
func ValidateName(name *string) error {
trimmedName := strings.TrimSpace(*name)
trimmedName := *name
trimmedName = strings.TrimSpace(trimmedName)
if trimmedName == "" {
return ErrEmptyName
}
if len(trimmedName) > MaxLengthName {
return ErrLongName
}
*name = trimmedName
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment