Package Usage: go: github.com/google/licensecheck
Package licensecheck classifies license files and heuristically determines
how well they correspond to known open source licenses.
A text (a slice of bytes) can be scanned for known licenses by calling Scan.
The resulting Coverage structure describes all the matches found as well
as what percentage of the file was covered by known matches.
The Scan function uses a built-in license set, which is the known SPDX licenses
augmented with some other commonly seen licenses.
(See licenses/README.md for details about the license set.)
A custom scanner can be created using NewScanner, passing in a set of
license patterns to scan for. The license patterns are written as license regular expressions (LREs).
BuiltinLicenses returns the set of license patterns used by Scan.
License Regular Expressions
Each license to be recognized is specified by writing a license regular expression (LRE) for it.
The pattern syntax and the matching are word-based and case-insensitive;
punctuation is ignored in the pattern and in the matched text.
The valid LRE patterns are:
To make patterns harder to misread in large texts:
(( must only appear at the start of a line (possibly indented);
)) and ))?? must only appear at the end of a line (with possible trailing spaces);
and || must only appear inside a (( )) or (( ))?? group.
For example:
An older, less precise matcher using the names Cover, New, and Checker
was removed from this package.
Use v0.1.0 for the final version of that API.
5 versions
Latest release: presque 5 ans ago
199 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/google/licensecheck