mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-22 16:07:34 +00:00
chore: use errors.New to replace fmt.Errorf with no parameters will much better
Signed-off-by: ChengenH <hce19970702@gmail.com>
This commit is contained in:
parent
ba614a5e6c
commit
9375b09206
@ -4,7 +4,6 @@ package hscontrol
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -279,13 +278,13 @@ func (api headscaleV1APIServer) SetTags(
|
|||||||
|
|
||||||
func validateTag(tag string) error {
|
func validateTag(tag string) error {
|
||||||
if strings.Index(tag, "tag:") != 0 {
|
if strings.Index(tag, "tag:") != 0 {
|
||||||
return fmt.Errorf("tag must start with the string 'tag:'")
|
return errors.New("tag must start with the string 'tag:'")
|
||||||
}
|
}
|
||||||
if strings.ToLower(tag) != tag {
|
if strings.ToLower(tag) != tag {
|
||||||
return fmt.Errorf("tag should be lowercase")
|
return errors.New("tag should be lowercase")
|
||||||
}
|
}
|
||||||
if len(strings.Fields(tag)) > 1 {
|
if len(strings.Fields(tag)) > 1 {
|
||||||
return fmt.Errorf("tag should not contains space")
|
return errors.New("tag should not contains space")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user