Skip to content

Commit

Permalink
Set initial values for some objects so we default to [] instead of nu…
Browse files Browse the repository at this point in the history
…ll. (#7)
  • Loading branch information
tiegz authored Aug 28, 2024
1 parent f3418b1 commit 406844d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/tidelift-sbom-vulnerability-reporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func main() {
}

func writeVulnerabilitiesReport(outputFile string, purls []packageurl.PackageURL, releaseInfo []api.ReleaseDetail) error {
var vulnerabilties []VulnerabilityDetails
vulnerabilties := []VulnerabilityDetails{}

for _, purl := range purls {
releasePurlString := purl.ToString()
Expand Down
9 changes: 5 additions & 4 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type releaseLookupResponse struct {
}

func GetPackageInfo(purls []packageurl.PackageURL) ([]api.PackageDetail, []api.Package) {
var packageInfo []api.PackageDetail
var missingPackages []api.Package
packageInfo := []api.PackageDetail{}
missingPackages := []api.Package{}

for start := 0; start < len(purls); start += CHUNK_SIZE {
purlStrings := chunkOfPurlStrings(purls, start, CHUNK_SIZE)
Expand All @@ -54,8 +54,9 @@ func GetPackageInfo(purls []packageurl.PackageURL) ([]api.PackageDetail, []api.P
}

func GetReleaseInfo(purls []packageurl.PackageURL) ([]api.ReleaseDetail, []PackageRelease) {
var releaseInfo []api.ReleaseDetail
var missingReleases []PackageRelease
releaseInfo := []api.ReleaseDetail{}
missingReleases := []PackageRelease{}

for start := 0; start < len(purls); start += CHUNK_SIZE {
purlStrings := chunkOfPurlStrings(purls, start, CHUNK_SIZE)

Expand Down

0 comments on commit 406844d

Please sign in to comment.