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

Revisit the source.New* set of functions #1866

Closed
kzantow opened this issue Jun 5, 2023 · 2 comments · Fixed by #1846
Closed

Revisit the source.New* set of functions #1866

kzantow opened this issue Jun 5, 2023 · 2 comments · Fixed by #1846
Labels
breaking-change Change is not backwards compatible
Milestone

Comments

@kzantow
Copy link
Contributor

kzantow commented Jun 5, 2023

The number of source.New* functions are getting a bit unwieldy. We should revisit this and pair the functions down to the necessary signatures, probably removing a number of them and maybe introducing a configuration object instead of permutations with different arguments.

@mcbenjemaa
Copy link

This is a Breacking change and its not clear how to migrate.
I have been using
input, err := source.ParseInput(fmt.Sprintf("registry:%s", img.ID), "")

Now how to change that?

@kzantow
Copy link
Contributor Author

kzantow commented Mar 5, 2024

@mcbenjemaa I'm not sure what the source.ParseInput call was doing -- I checked out commit 928511e, which is the one prior to the recent source refactoring and I can't find a source.ParseInput function. Before the calls were generally:

detection, err = source.Detect(...)
soure, err := detection.NewSource(...)

Now you just need to call syft.GetSource, similar to this example: https://github.com/anchore/syft/pull/2691/files#diff-ca91d24ca0dbc33485279b92a42b44ab2e2565fe87e04fb77c50ac78c1c37bc0R15

src, err := syft.GetSource(context.Background(), image, syft.DefaultGetSourceConfig().WithSources("registry"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Change is not backwards compatible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants