licenses

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

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

)

Variables

This section is empty.

Functions

func FileNames

func FileNames() []string

func IsContextLicenseScannerSet added in v1.23.0

func IsContextLicenseScannerSet(ctx context.Context) bool

func SetContextLicenseScanner added in v1.14.2

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

Types

type Evidence added in v1.24.0

type Evidence struct {
	ID    string            // License identifier. (See licenses/README.md.)
	Type  licensecheck.Type // The type of the license: BSD, MIT, etc.
	Start int               // Start offset of match in text; match is at text[Start:End].
	End   int               // End offset of match in text.
	IsURL bool              // Whether match is a URL.
}

type Option added in v1.20.0

type Option func(*scanner)

func WithCoverage added in v1.20.0

func WithCoverage(coverage float64) Option

type Scanner added in v1.14.2

type Scanner interface {
	FindEvidence(context.Context, io.Reader) ([]Evidence, []byte, error)
}

func ContextLicenseScanner added in v1.14.2

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

func NewDefaultScanner added in v1.14.2

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

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

func NewScanner added in v1.20.0

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

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

type ScannerConfig added in v1.20.0

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

Jump to

Keyboard shortcuts

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