Skip to content

Commit 941e6aa

Browse files
committed
Preallocate slice in update_test.go
Use make() with a known capacity instead of an empty slice literal, so the append loop doesn't have to grow the backing array.
1 parent 22456f0 commit 941e6aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/dependabot/internal/cmd/update_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func Test_processInput(t *testing.T) {
191191
}
192192
}
193193

194-
actualCredentialsMetadataHosts := []string{}
194+
actualCredentialsMetadataHosts := make([]string, 0, len(credentialsMetadataHosts))
195195
for host := range credentialsMetadataHosts {
196196
actualCredentialsMetadataHosts = append(actualCredentialsMetadataHosts, host)
197197
}

0 commit comments

Comments
 (0)