Skip to content

Commit

Permalink
chore: use errors.New to replace fmt.Errorf with no parameters will m…
Browse files Browse the repository at this point in the history
…uch better

Signed-off-by: ChengenH <hce19970702@gmail.com>
  • Loading branch information
ChengenH authored and juanfont committed Apr 21, 2024
1 parent ba614a5 commit 9375b09
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hscontrol/grpcv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package hscontrol
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"time"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 9375b09

Please sign in to comment.