Documentation ¶
Index ¶
Constants ¶
const ( // Unknown license type. Unknown = Type("") // Restricted licenses require mandatory source distribution if we ship a // product that includes third-party code protected by such a license. Restricted = Type("restricted") // Reciprocal licenses allow usage of software made available under such // licenses freely in *unmodified* form. If the third-party source code is // modified in any way these modifications to the original third-party // source code must be made available. Reciprocal = Type("reciprocal") // Notice licenses contain few restrictions, allowing original or modified // third-party software to be shipped in any product without endangering or // encumbering our source code. All of the licenses in this category do, // however, have an "original Copyright notice" or "advertising clause", // wherein any external distributions must include the notice or clause // specified in the license. Notice = Type("notice") // Permissive licenses are even more lenient than a 'notice' license. // Not even a copyright notice is required for license compliance. Permissive = Type("permissive") // Unencumbered covers licenses that basically declare that the code is "free for any use". Unencumbered = Type("unencumbered") // Forbidden licenses are forbidden to be used. Forbidden = Type("FORBIDDEN") )
License types
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Classifier ¶
Classifier can detect the type of a software license.
func NewClassifier ¶
func NewClassifier(confidenceThreshold float64, options ...licenseclassifier.OptionFunc) (Classifier, error)
NewClassifier creates a classifier that requires a specified confidence threshold in order to return a positive license classification.
type GitRepo ¶
type GitRepo struct {
// contains filtered or unexported fields
}
GitRepo represents a Git repository that exists on disk locally.
func FindGitRepo ¶
FindGitRepo finds the Git repository that contains the specified filePath by searching upwards through the directory tree for a ".git" directory.
type Library ¶
type Library struct { // LicensePath is the path of the file containing the library's license. LicensePath string // Packages contains import paths for Go packages in this library. // It may not be the complete set of all packages in the library. Packages []string }
Library is a collection of packages covered by the same license file.
func Libraries ¶
func Libraries(ctx context.Context, classifier Classifier, importPaths ...string) ([]*Library, error)
Libraries returns the collection of libraries used by this package, directly or transitively. A library is a collection of one or more packages covered by the same license file. Packages not covered by a license will be returned as individual libraries. Standard library packages will be ignored.
func (*Library) FileURL ¶
FileURL attempts to determine the URL for a file in this library. This only works for certain supported package prefixes, such as github.com, bitbucket.org and googlesource.com. Prefer GitRepo.FileURL() if possible.
type PackagesError ¶
type PackagesError struct {
// contains filtered or unexported fields
}
PackagesError aggregates all Packages[].Errors into a single error.
func (PackagesError) Error ¶
func (e PackagesError) Error() string