Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gosum support #475

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

alessandro-Doyensec
Copy link

This PR enables scalibr to search for indirect dependencies inside the go.sum if the go.mod's golang version is < 1.17.

This feature is necessary since before 1.17 every indirect dependency was only present in the go.sum file.

Copy link

google-cla bot commented Feb 19, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

trigger google cla check
// extractFromSum extracts dependencies from the go.sum file.
//
// Note: This function may produce false positives, as the go.sum file might be outdated.
func extractFromSum(input *filesystem.ScanInput) ([]*extractor.Inventory, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean go.sum files only exist when a go.mod file is present, no matter what go version?

log.Warnf("Error reading go.sum file: %s", err)
} else {
for _, p := range sumPackages {
packages[mapKey{name: p.Name, version: p.Version}] = p
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this will overwrite packages from go.mod, right? I think we don't want to do this deduplication. If we skip it we can also add go.sum in FileRequired and replace Extract with a "if" between extractGoMod and extractGoSum. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants