Skip to content

Commit

Permalink
If go version can't be found, don't add stdlib (#494)
Browse files Browse the repository at this point in the history
If go version can't be found, don't add stdlib to the parsed packages.
  • Loading branch information
another-rex committed Aug 18, 2023
1 parent 86daa9a commit 3cab6fa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/osvscanner/optional_enricher.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ func addCompilerVersion(r reporter.Reporter, parsedLockfile *lockfile.Lockfile)
goVer, err := getGoVersion()
if err != nil {
r.PrintError(fmt.Sprintf("cannot get go standard library version, go might not be installed: %s", err))
} else {
parsedLockfile.Packages = append(parsedLockfile.Packages, lockfile.PackageDetails{
Name: "stdlib",
Version: goVer,
Ecosystem: lockfile.GoEcosystem,
CompareAs: lockfile.GoEcosystem,
})
}
parsedLockfile.Packages = append(parsedLockfile.Packages, lockfile.PackageDetails{
Name: "stdlib",
Version: goVer,
Ecosystem: lockfile.GoEcosystem,
CompareAs: lockfile.GoEcosystem,
})
}
}

0 comments on commit 3cab6fa

Please sign in to comment.