scanner

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scanner turns a source tree into WFP fingerprints. It collects the files to scan (delegating filtering to pkg/filter via CollectFiles / CollectFilesWithOptions) and fingerprints them in parallel through a bounded worker pool (WorkerPool / GenerateWFP) using the WFP algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectFiles

func CollectFiles(rootPath string) ([]string, error)

CollectFiles recursively collects the files to scan under rootPath, applying the built-in default filters (skip lists, sizes) plus any .gitignore in the tree. Kept for backward compatibility; use CollectFilesWithOptions to also apply scanoss.json rules or to override the defaults.

func CollectFilesWithOptions

func CollectFilesWithOptions(rootPath string, o filter.Options) (*filter.CollectResult, error)

CollectFilesWithOptions recursively collects the files to scan under rootPath, applying the given filter options (defaults, scanoss.json skip rules, .gitignore, size bounds). It returns the files to scan and a count of skipped files.

func GenerateWFP

func GenerateWFP(files []string, workers int, root string, onProgress func(done, total int)) ([]byte, []error)

GenerateWFP fingerprints the given files with a worker pool and returns the combined WFP byte stream. onProgress, if non-nil, is called as each file completes (done, total). Files that fail to fingerprint are skipped and returned in the error slice (best-effort).

Types

type WorkerPool

type WorkerPool struct {
	// contains filtered or unexported fields
}

WorkerPool manages a pool of workers to process files in parallel

func NewWorkerPool

func NewWorkerPool(numWorkers int) *WorkerPool

NewWorkerPool creates a new worker pool

func (*WorkerPool) Close

func (wp *WorkerPool) Close()

Close closes the channels and waits for workers to finish

func (*WorkerPool) Errors

func (wp *WorkerPool) Errors() <-chan error

Errors returns the errors channel

func (*WorkerPool) Results

func (wp *WorkerPool) Results() <-chan *models.FileFingerprint

Results returns the results channel

func (*WorkerPool) Start

func (wp *WorkerPool) Start()

Start starts the workers

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(filePath string)

Submit sends a file to be processed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL