Skip to content

Commit

Permalink
[chore] preallocate slice (#24960)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Aug 7, 2023
1 parent 37cc6aa commit 1c00b6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions receiver/awscloudwatchreceiver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ var (
)

func loadLogGroups(t *testing.T) *cloudwatchlogs.DescribeLogGroupsOutput {
var output []*cloudwatchlogs.LogGroup
for _, lg := range logGroupFiles {
output := make([]*cloudwatchlogs.LogGroup, len(logGroupFiles))
for i, lg := range logGroupFiles {
bytes, err := os.ReadFile(lg)
require.NoError(t, err)
var logGroup cloudwatchlogs.LogGroup
err = json.Unmarshal(bytes, &logGroup)
require.NoError(t, err)
output = append(output, &logGroup)
output[i] = &logGroup
}

return &cloudwatchlogs.DescribeLogGroupsOutput{
Expand All @@ -95,14 +95,14 @@ func loadLogGroups(t *testing.T) *cloudwatchlogs.DescribeLogGroupsOutput {
}

func loadLogEvents(t *testing.T) *cloudwatchlogs.FilterLogEventsOutput {
var output []*cloudwatchlogs.FilteredLogEvent
for _, lg := range logEventsFiles {
output := make([]*cloudwatchlogs.FilteredLogEvent, len(logEventsFiles))
for i, lg := range logEventsFiles {
bytes, err := os.ReadFile(lg)
require.NoError(t, err)
var event cloudwatchlogs.FilteredLogEvent
err = json.Unmarshal(bytes, &event)
require.NoError(t, err)
output = append(output, &event)
output[i] = &event
}

return &cloudwatchlogs.FilterLogEventsOutput{
Expand Down

0 comments on commit 1c00b6e

Please sign in to comment.