test: fix slice init length (#2133)

Signed-off-by: xixishidibei <xixishidibei@outlook.com>
This commit is contained in:
xixishidibei 2024-09-18 23:56:42 +08:00 committed by GitHub
parent 60c0682bb4
commit 14398b776e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -355,7 +355,7 @@ type MockMetadataProvider struct{}
func (m *MockMetadataProvider) GetMetadata(id, namespace string) (*vulnerability.Metadata, error) { func (m *MockMetadataProvider) GetMetadata(id, namespace string) (*vulnerability.Metadata, error) {
cvss := func(id string, namespace string, scores ...float64) vulnerability.Metadata { cvss := func(id string, namespace string, scores ...float64) vulnerability.Metadata {
values := make([]vulnerability.Cvss, len(scores)) values := make([]vulnerability.Cvss, 0, len(scores))
for _, score := range scores { for _, score := range scores {
values = append(values, vulnerability.Cvss{ values = append(values, vulnerability.Cvss{
Metrics: vulnerability.CvssMetrics{ Metrics: vulnerability.CvssMetrics{