Skip to content

Commit

Permalink
bug: fix slice init length (#40637) (#41515)
Browse files Browse the repository at this point in the history
Signed-off-by: dufucun <dufuchun@sohu.com>
Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Co-authored-by: Anderson Queiroz <anderson.queiroz@elastic.co>
(cherry picked from commit 092929b)

Co-authored-by: dufucun <dufuchun@sohu.com>
  • Loading branch information
mergify[bot] and dufucun authored Nov 5, 2024
1 parent 4ef27a9 commit a91af5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libbeat/processors/fingerprint/fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func nRandomEvents(num int) []beat.Event {
charsetLen := len(charset)
b := make([]byte, 200)

events := make([]beat.Event, num)
events := make([]beat.Event, 0, num)
for i := 0; i < num; i++ {
for j := range b {
b[j] = charset[prng.Intn(charsetLen)]
Expand Down
2 changes: 1 addition & 1 deletion libbeat/processors/ratelimit/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (l *rate) Unpack(str string) error {
}

if allowed := []unit{unitPerSecond, unitPerMinute, unitPerHour}; !contains(allowed, unitStr) {
allowedStrs := make([]string, len(allowed))
allowedStrs := make([]string, 0, len(allowed))
for _, a := range allowed {
allowedStrs = append(allowedStrs, "/"+string(a))
}
Expand Down

0 comments on commit a91af5b

Please sign in to comment.