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

fix

parent 873b5d9c
No related branches found
No related tags found
No related merge requests found
......@@ -27,14 +27,13 @@ func GenerateNewID() string {
}
func ValidateID(id string) error {
trimmedID := strings.TrimSpace(id)
if trimmedID == "" {
if strings.TrimSpace(id) == "" {
return ErrEmptyID
}
if len(trimmedID) > MaxLengthID {
if len(id) > MaxLengthID {
return ErrLongID
}
if !isValidID(trimmedID) {
if !isValidID(id) {
return errors.WithDetail(ErrNotValidID, "must begin with latin letters and contain latin letters, numbers or '-', '_'")
}
......@@ -42,11 +41,10 @@ func ValidateID(id string) error {
}
func ValidateName(name string) error {
trimmedName := strings.TrimSpace(name)
if trimmedName == "" {
if strings.TrimSpace(name) == "" {
return ErrEmptyName
}
if len(trimmedName) > MaxLengthName {
if len(name) > MaxLengthName {
return ErrLongName
}
......
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