This is an automated email from the ASF dual-hosted git repository.

mark4z pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git


The following commit(s) were added to refs/heads/develop by this push:
     new 2dc553e  style:create map to allocate space
     new 908f042  Merge pull request #358 from baerwang/develop
2dc553e is described below

commit 2dc553e753d54db9819b0dd58786795d793c8544
Author: baerwang <[email protected]>
AuthorDate: Sun Jan 30 23:11:17 2022 +0800

    style:create map to allocate space
---
 pkg/filter/ratelimit/exact.go | 2 +-
 pkg/filter/ratelimit/regex.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/filter/ratelimit/exact.go b/pkg/filter/ratelimit/exact.go
index edfa932..3e94269 100644
--- a/pkg/filter/ratelimit/exact.go
+++ b/pkg/filter/ratelimit/exact.go
@@ -28,7 +28,7 @@ type Exact struct {
 }
 
 func (p *Exact) load(apis []*Resource) {
-       m := map[string]string{}
+       m := make(map[string]string, len(apis))
 
        for _, api := range apis {
                apiName := api.Name
diff --git a/pkg/filter/ratelimit/regex.go b/pkg/filter/ratelimit/regex.go
index 4064c22..2186f37 100644
--- a/pkg/filter/ratelimit/regex.go
+++ b/pkg/filter/ratelimit/regex.go
@@ -29,7 +29,7 @@ type Regex struct {
 }
 
 func (p *Regex) load(apis []*Resource) {
-       m := map[string]string{}
+       m := make(map[string]string, len(apis))
 
        for _, api := range apis {
                apiName := api.Name

Reply via email to