func EcosystemsToScanners(ctx context.Context, ecosystems []*Ecosystem, disallowRemote bool) ([]PackageScanner, []DistributionScanner, []RepositoryScanner, error) {
	log := zerolog.Ctx(ctx).With().
		Str("component", "internal/indexer/EcosystemsToScanners").
		Logger()
	ctx = log.WithContext(ctx)
	ps := []PackageScanner{}
	ds := []DistributionScanner{}
	rs := []RepositoryScanner{}
	seen := map[string]struct{}{}

	for _, ecosystem := range ecosystems {
		pscanners, err := ecosystem.PackageScanners(ctx)
		if err != nil {
			return nil, nil, nil, err
		}
		for _, s := range pscanners {
			n := s.Name()
			if _, ok := seen[n]; ok {
				continue
			}
			seen[n] = struct{}{}
			if _, ok := s.(RPCScanner); ok && disallowRemote {
				log.Info().
					Str("scanner", n).
					Msg("disallowed by configuration")
				continue
			}
			ps = append(ps, s)
		}

		dscanners, err := ecosystem.DistributionScanners(ctx)
		if err != nil {
			return nil, nil, nil, err
		}
		for _, s := range dscanners {
			n := s.Name()
			if _, ok := seen[n]; ok {
				continue
			}
			seen[n] = struct{}{}
			if _, ok := s.(RPCScanner); ok && disallowRemote {
				log.Info().
					Str("scanner", n).
					Msg("disallowed by configuration")
				continue
			}
			ds = append(ds, s)
		}

		rscanners, err := ecosystem.RepositoryScanners(ctx)
		if err != nil {
			return nil, nil, nil, err
		}
		for _, s := range rscanners {
			n := s.Name()
			if _, ok := seen[n]; ok {
				continue
			}
			seen[n] = struct{}{}
			if _, ok := s.(RPCScanner); ok && disallowRemote {
				log.Info().
					Str("scanner", n).
					Msg("disallowed by configuration")
				continue
			}
			rs = append(rs, s)
		}
	}
	return ps, ds, rs, nil
}
// EcosystemsToScanners extracts and dedupes multiple ecosystems and returns their discrete scanners
EcosystemsToScanners extracts and dedupes multiple ecosystems and returns their discrete scanners
// EcosystemsToScanners extracts and dedupes multiple ecosystems and returns their discrete scanners
func EcosystemsToScanners(ctx context.Context, ecosystems []*Ecosystem, disallowRemote bool) ([]PackageScanner, []DistributionScanner, []RepositoryScanner, error) {
	log := zerolog.Ctx(ctx).With().
		Str("component", "internal/indexer/EcosystemsToScanners").
		Logger()
	ctx = log.WithContext(ctx)
	ps := []PackageScanner{}
	ds := []DistributionScanner{}
	rs := []RepositoryScanner{}
	seen := map[string]struct{}{}
	for _, ecosystem := range ecosystems {
		pscanners, err := ecosystem.PackageScanners(ctx)
		if err != nil {
			return nil, nil, nil, err
		}
		for _, s := range pscanners {
			n := s.Name()
			if _, ok := seen[n]; ok {
				continue
			}
			seen[n] = struct{}{}
			if _, ok := s.(RPCScanner); ok && disallowRemote {
				log.Info().
					Str("scanner", n).
					Msg("disallowed by configuration")
				continue
			}
			ps = append(ps, s)
		}
		dscanners, err := ecosystem.DistributionScanners(ctx)
		if err != nil {
			return nil, nil, nil, err
		}
		for _, s := range dscanners {
			n := s.Name()
			if _, ok := seen[n]; ok {
				continue
			}
			seen[n] = struct{}{}
			if _, ok := s.(RPCScanner); ok && disallowRemote {
				log.Info().
					Str("scanner", n).
					Msg("disallowed by configuration")
				continue
			}
			ds = append(ds, s)
		}
		rscanners, err := ecosystem.RepositoryScanners(ctx)
		if err != nil {
			return nil, nil, nil, err
		}
		for _, s := range rscanners {
			n := s.Name()
			if _, ok := seen[n]; ok {
				continue
			}
			seen[n] = struct{}{}
			if _, ok := s.(RPCScanner); ok && disallowRemote {
				log.Info().
					Str("scanner", n).
					Msg("disallowed by configuration")
				continue
			}
			rs = append(rs, s)
		}
	}
	return ps, ds, rs, nil
}
func EcosystemsToScanners ( ctx context . Context , ecosystems [ ] * Ecosystem , disallowRemote bool ) ( [ ] PackageScanner , [ ] DistributionScanner , [ ] RepositoryScanner , error ) { log := zerolog . Ctx ( ctx ) . With ( ) . Str ( " " , " " ) . Logger ( ) ctx = log . WithContext ( ctx ) ps := [ ] PackageScanner { } ds := [ ] DistributionScanner { } rs := [ ] RepositoryScanner { } seen := map [ string ] struct { } { } for _ , ecosystem := range ecosystems { pscanners , err := ecosystem . PackageScanners ( ctx ) if err != nil { return nil , nil , nil , err } for _ , s := range pscanners { n := s . Name ( ) if _ , ok := seen [ n ] ; ok { continue } seen [ n ] = struct { } { } if _ , ok := s . ( RPCScanner ) ; ok && disallowRemote { log . Info ( ) . Str ( " " , n ) . Msg ( " " ) continue } ps = append ( ps , s ) } dscanners , err := ecosystem . DistributionScanners ( ctx ) if err != nil { return nil , nil , nil , err } for _ , s := range dscanners { n := s . Name ( ) if _ , ok := seen [ n ] ; ok { continue } seen [ n ] = struct { } { } if _ , ok := s . ( RPCScanner ) ; ok && disallowRemote { log . Info ( ) . Str ( " " , n ) . Msg ( " " ) continue } ds = append ( ds , s ) } rscanners , err := ecosystem . RepositoryScanners ( ctx ) if err != nil { return nil , nil , nil , err } for _ , s := range rscanners { n := s . Name ( ) if _ , ok := seen [ n ] ; ok { continue } seen [ n ] = struct { } { } if _ , ok := s . ( RPCScanner ) ; ok && disallowRemote { log . Info ( ) . Str ( " " , n ) . Msg ( " " ) continue } rs = append ( rs , s ) } } return ps , ds , rs , nil }
EcosystemsToScanners extracts and dedupes multiple ecosystems and returns their discrete scanners
EcosystemsToScanners extracts and dedupes multiple ecosystems and returns their discrete scanners