1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-17 17:44:30 +02:00

style:arrays pre-allocation (#2449)

This commit is contained in:
baerwang 2022-03-14 14:03:14 +08:00 committed by GitHub
parent d6a74c1a8e
commit 356448017f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,9 +4,9 @@ import (
"sync"
"time"
jwtToken "github.com/asim/go-micro/plugins/auth/jwt/v4/token"
"go-micro.dev/v4/auth"
"go-micro.dev/v4/cmd"
jwtToken "github.com/asim/go-micro/plugins/auth/jwt/v4/token"
)
func init() {
@ -92,7 +92,7 @@ func (j *jwtRules) Revoke(rule *auth.Rule) error {
j.Lock()
defer j.Unlock()
rules := []*auth.Rule{}
rules := make([]*auth.Rule, 0, len(j.rules))
for _, r := range j.rules {
if r.ID != rule.ID {
rules = append(rules, r)