detectlicense

package
v1.13.2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Proprietary = License{Name: "proprietary"}

	PublicDomain = License{Name: "public domain"}

	Apache2 = License{Name: "Apache License 2.0", NoticeFile: true}
	BSD1    = License{Name: "1-clause BSD license"}
	BSD2    = License{Name: "2-clause BSD license"}
	BSD3    = License{Name: "3-clause BSD license"}
	ISC     = License{Name: "ISC license"}
	MIT     = License{Name: "MIT license"}
	MPL2    = License{Name: "Mozilla Public License 2.0", NoticeFile: true, WeakCopyleft: true}

	CcBySa40 = License{Name: "Creative Commons Attribution Share Alike 4.0 International", StrongCopyleft: true}
)

Functions

func DetectLicenses

func DetectLicenses(files map[string][]byte) (map[License]struct{}, error)

func IdentifyLicenses

func IdentifyLicenses(body []byte) map[License]struct{}

IdentifyLicense takes the contents of a license-file and attempts to identify the license(s) in it. If it is even a little unsure, it returns nil.

func IdentifySPDXLicenses

func IdentifySPDXLicenses(body []byte) (map[License]struct{}, error)

IdentifySPDX takes the contents of a source-file and looks for SPDX license identifiers.

Types

type License

type License struct {
	Name           string
	NoticeFile     bool // are NOTICE files "a thing" for this license?
	WeakCopyleft   bool // requires that library to be open-source
	StrongCopyleft bool // requires the resulting program to be open-source
}

Jump to

Keyboard shortcuts

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