Skip to content

Commit ff53e81

Browse files
committed
fix: avoid another data race
1 parent c42faa0 commit ff53e81

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/database/api-fetch-all.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ func (db APIDB) FetchAll(ids []string) Vulnerabilities {
1111

1212
eg.SetLimit(200)
1313

14-
var osvs Vulnerabilities
14+
osvs := make(Vulnerabilities, len(ids))
1515

16-
for _, id := range ids {
16+
for i, id := range ids {
1717
eg.Go(func() error {
1818
// if we error, still report the vulnerability as hopefully the ID should be
1919
// enough to manually look up the details - in future we should ideally warn
2020
// the user too, but for now we just silently eat the error
2121
osv, _ := db.Fetch(id)
2222

23-
osvs = append(osvs, osv)
23+
osvs[i] = osv
2424

2525
return nil
2626
})

0 commit comments

Comments
 (0)