licenses

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCoverageThreshold     = 75 // determined by experimentation
	DefaultIncludeLicenseContent = false
)
View Source
const (
	UnknownLicensePrefix = unknownLicenseType + "_"
)

Variables

This section is empty.

Functions

func FileNames

func FileNames() []string

func SetContextLicenseScanner

func SetContextLicenseScanner(ctx context.Context, s Scanner) context.Context

Types

type Option

type Option func(*scanner)

func WithCoverage

func WithCoverage(coverage float64) Option

func WithIncludeLicenseContent

func WithIncludeLicenseContent(includeLicenseContent bool) Option

type Scanner

type Scanner interface {
	IdentifyLicenseIDs(context.Context, io.Reader) ([]string, []byte, error)
	FileSearch(context.Context, file.LocationReadCloser) ([]file.License, error)
	PkgSearch(context.Context, file.LocationReadCloser) ([]pkg.License, error)
}

func ContextLicenseScanner

func ContextLicenseScanner(ctx context.Context) (Scanner, error)

func NewDefaultScanner

func NewDefaultScanner(o ...Option) (Scanner, error)

NewDefaultScanner returns a scanner that uses a new instance of the default licensecheck package scanner.

func NewScanner

func NewScanner(c *ScannerConfig) (Scanner, error)

NewScanner generates a license Scanner with the given ScannerConfig if config is nil NewDefaultScanner is used

type ScannerConfig

type ScannerConfig struct {
	CoverageThreshold     float64
	IncludeLicenseContent bool
	Scanner               func([]byte) licensecheck.Coverage
}

Jump to

Keyboard shortcuts

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