mirror of
https://github.com/anchore/syft
synced 2024-11-10 06:14:16 +00:00
exclusions does not need to be variadic (#711)
This commit is contained in:
parent
cc20a8f341
commit
b7979dbc7d
6 changed files with 8 additions and 8 deletions
|
@ -262,7 +262,7 @@ func packagesExecWorker(userInput string) <-chan error {
|
|||
|
||||
checkForApplicationUpdate()
|
||||
|
||||
src, cleanup, err := source.New(userInput, appConfig.Registry.ToOptions(), appConfig.Exclusions...)
|
||||
src, cleanup, err := source.New(userInput, appConfig.Registry.ToOptions(), appConfig.Exclusions)
|
||||
if err != nil {
|
||||
errs <- fmt.Errorf("failed to determine image source: %w", err)
|
||||
return
|
||||
|
|
|
@ -113,7 +113,7 @@ func powerUserExecWorker(userInput string) <-chan error {
|
|||
|
||||
checkForApplicationUpdate()
|
||||
|
||||
src, cleanup, err := source.New(userInput, appConfig.Registry.ToOptions(), appConfig.Exclusions...)
|
||||
src, cleanup, err := source.New(userInput, appConfig.Registry.ToOptions(), appConfig.Exclusions)
|
||||
if err != nil {
|
||||
errs <- err
|
||||
return
|
||||
|
|
|
@ -35,7 +35,7 @@ type Source struct {
|
|||
type sourceDetector func(string) (image.Source, string, error)
|
||||
|
||||
// New produces a Source based on userInput like dir: or image:tag
|
||||
func New(userInput string, registryOptions *image.RegistryOptions, exclusions ...string) (*Source, func(), error) {
|
||||
func New(userInput string, registryOptions *image.RegistryOptions, exclusions []string) (*Source, func(), error) {
|
||||
fs := afero.NewOsFs()
|
||||
parsedScheme, imageSource, location, err := detectScheme(fs, image.DetectSource, userInput)
|
||||
if err != nil {
|
||||
|
|
|
@ -420,7 +420,7 @@ func TestDirectoryExclusions(t *testing.T) {
|
|||
registryOpts := &image.RegistryOptions{}
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
src, fn, err := New("dir:"+test.input, registryOpts, test.exclusions...)
|
||||
src, fn, err := New("dir:"+test.input, registryOpts, test.exclusions)
|
||||
defer fn()
|
||||
|
||||
if test.err {
|
||||
|
@ -512,7 +512,7 @@ func TestImageExclusions(t *testing.T) {
|
|||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
archiveLocation := imagetest.PrepareFixtureImage(t, "docker-archive", test.input)
|
||||
src, fn, err := New(archiveLocation, registryOpts, test.exclusions...)
|
||||
src, fn, err := New(archiveLocation, registryOpts, test.exclusions)
|
||||
defer fn()
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -22,7 +22,7 @@ func BenchmarkImagePackageCatalogers(b *testing.B) {
|
|||
var pc *pkg.Catalog
|
||||
for _, c := range cataloger.ImageCatalogers() {
|
||||
// in case of future alteration where state is persisted, assume no dependency is safe to reuse
|
||||
theSource, cleanupSource, err := source.New("docker-archive:"+tarPath, nil)
|
||||
theSource, cleanupSource, err := source.New("docker-archive:"+tarPath, nil, nil)
|
||||
b.Cleanup(cleanupSource)
|
||||
if err != nil {
|
||||
b.Fatalf("unable to get source: %+v", err)
|
||||
|
|
|
@ -14,7 +14,7 @@ func catalogFixtureImage(t *testing.T, fixtureImageName string) (sbom.SBOM, *sou
|
|||
imagetest.GetFixtureImage(t, "docker-archive", fixtureImageName)
|
||||
tarPath := imagetest.GetFixtureImageTarPath(t, fixtureImageName)
|
||||
|
||||
theSource, cleanupSource, err := source.New("docker-archive:"+tarPath, nil)
|
||||
theSource, cleanupSource, err := source.New("docker-archive:"+tarPath, nil, nil)
|
||||
t.Cleanup(cleanupSource)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get source: %+v", err)
|
||||
|
@ -45,7 +45,7 @@ func catalogFixtureImage(t *testing.T, fixtureImageName string) (sbom.SBOM, *sou
|
|||
}
|
||||
|
||||
func catalogDirectory(t *testing.T, dir string) (sbom.SBOM, *source.Source) {
|
||||
theSource, cleanupSource, err := source.New("dir:"+dir, nil)
|
||||
theSource, cleanupSource, err := source.New("dir:"+dir, nil, nil)
|
||||
t.Cleanup(cleanupSource)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get source: %+v", err)
|
||||
|
|
Loading…
Reference in a new issue