From 9375b0920696f3aae23f6cf96643304b96531e71 Mon Sep 17 00:00:00 2001 From: ChengenH Date: Sun, 21 Apr 2024 22:53:50 +0800 Subject: [PATCH] chore: use errors.New to replace fmt.Errorf with no parameters will much better Signed-off-by: ChengenH --- hscontrol/grpcv1.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hscontrol/grpcv1.go b/hscontrol/grpcv1.go index 41be5e9..d9cd653 100644 --- a/hscontrol/grpcv1.go +++ b/hscontrol/grpcv1.go @@ -4,7 +4,6 @@ package hscontrol import ( "context" "errors" - "fmt" "sort" "strings" "time" @@ -279,13 +278,13 @@ func (api headscaleV1APIServer) SetTags( func validateTag(tag string) error { 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 { - return fmt.Errorf("tag should be lowercase") + return errors.New("tag should be lowercase") } if len(strings.Fields(tag)) > 1 { - return fmt.Errorf("tag should not contains space") + return errors.New("tag should not contains space") } return nil }