Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: fix slice init length #40637

Merged
merged 6 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
mauri870 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
valueStr := strings.TrimSpace(parts[0])
unitStr := strings.TrimSpace(parts[1])

v, err := strconv.ParseFloat(valueStr, 8)

Check failure on line 49 in libbeat/processors/ratelimit/limit.go

View workflow job for this annotation

GitHub Actions / lint (windows)

SA1030: 'bitSize' argument is invalid, must be either 32 or 64 (staticcheck)
if err != nil {
return fmt.Errorf(`rate's value component is not numeric: %v`, valueStr)
}

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
Loading