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

cataloger: golang source cataloger #3451

Open
spiffcs opened this issue Nov 18, 2024 · 0 comments · May be fixed by #3452
Open

cataloger: golang source cataloger #3451

spiffcs opened this issue Nov 18, 2024 · 0 comments · May be fixed by #3452
Labels
enhancement New feature or request

Comments

@spiffcs
Copy link
Contributor

spiffcs commented Nov 18, 2024

What would you like to be added:
A cataloger that is invoked on a directory scan for the Golang Ecosystem that discovers all **/go.mod files. The cataloger will use the main module at the top of the modfile and then load all the root packages via the Golang tools utilities found here golang.org/x/tools/go/packages.

These root packages will be created as syft packages for the SBOM. The cataloger will also visit all of the packages in the import graph whose roots are in the inital root package list. This will allow the cataloger to surface all direct and transitive dependencies for a given main module. Vendored dependencies also have the additional bonus of allowing for license discovery during this method since the modules dirPath is surfaced during its discovery by the x/tools/go/packages utility

Why is this needed:

More accurate Golang source cataloging. Currently we only parse the flat list from go.mod or dependency information from discovered go binaries. This new feature will give a more complete overview of all the modules imported by a go project. Some projects can have more than one go.mod file which could lead to "duplicate" dependencies being discovered during this process. It's important to include in the main package discovered the root parent so that it's obvious to consumers of the SBOM that these "duplicates" belong to different main modules.

@spiffcs spiffcs added the enhancement New feature or request label Nov 18, 2024
@spiffcs spiffcs linked a pull request Nov 18, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant