Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
873b5d9c
Commit
873b5d9c
authored
1 year ago
by
ko_oler
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
8489e58d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/id/id.go
+6
-1
6 additions, 1 deletion
pkg/id/id.go
with
6 additions
and
1 deletion
pkg/id/id.go
+
6
−
1
View file @
873b5d9c
...
...
@@ -17,6 +17,7 @@ var (
ErrEmptyID
=
errors
.
New
(
"empty ID"
)
ErrNotValidID
=
errors
.
New
(
"id contains invalid characters"
)
ErrLongID
=
errors
.
New
(
"id too long (max 64 symbols)"
)
ErrEmptyName
=
errors
.
New
(
"empty name"
)
ErrLongName
=
errors
.
New
(
"name too long (max 256 symbols)"
)
isValidID
=
regexp
.
MustCompile
(
`^[A-Za-z][A-Za-z0-9-_]*$`
)
.
MatchString
)
...
...
@@ -41,7 +42,11 @@ func ValidateID(id string) error {
}
func
ValidateName
(
name
string
)
error
{
if
len
(
name
)
>
MaxLengthName
{
trimmedName
:=
strings
.
TrimSpace
(
name
)
if
trimmedName
==
""
{
return
ErrEmptyName
}
if
len
(
trimmedName
)
>
MaxLengthName
{
return
ErrLongName
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment