Documentation
¶
Index ¶
- Variables
- func AreListsMatching(a, b []string) bool
- func AreTokensListsMatchingSwap(a, b []string) bool
- func AreTokensMatching(a, b string) bool
- func CanonicalToAllForms(canonical string) (forms []string)
- func CanonicalToGlobs(canonical string) (globs []string)
- func DedupInPlace(ss []string) []string
- func GetGlobs(token string) []string
- func GetText(name string) *string
- func GlobToFirstMatch(glob string) string
- func HyphenPrefixes(s string) []string
- func List() []string
- func SeparateTokenList(tokens []string) (licenses, exceptions []string)
- func ToShort(text string) string
- func TokenToCanonical(token string) string
- func Tokenise(text string) []string
- func TokensToCanonical(tokens []string) []string
- func TokensToShort(tokens []string) map[string]string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Files map[string]*zip.File Filenames []string Globs map[string][]string Canonical map[string]string )
View Source
var ( Keywords = []string{"WITH", "AND", "OR"} // Map of Deprecated IDs to expressions // Result of mapping may be ambiguous Deprecated = map[string][]string{ "gpl-3.0+": {"gpl-3.0-or-later"}, "gpl-2.0+": {"gpl-2.0-or-later"}, "gpl-3.0-with-autoconf-exception": { "gpl-3.0-or-later", "with", "autoconf-exception-3.0", }, "gpl-3.0-with-gcc-exception": { "gpl-3.0-or-later", "with", "gcc-exception-3.1", }, } Aliases = []struct{ from, to string }{ {"gpl3", "GPL-3.0"}, {"gpl-3", "GPL-3.0"}, {"gpl2", "GPL-2.0"}, {"gpl-2", "GPL-2.0"}, {"asl20", "Apache-2.0"}, {"asl11", "Apache-1.1"}, } // TODO: ExceptionsList = []string{ "GNU-compiler-exception", "GNOME-examples-exception", "Autoconf-exception-generic", "Autoconf-exception-generic-3.0", "Autoconf-exception-macro", "Autoconf-exception-2.0", "Autoconf-exception-3.0", "GCC-exception-2.0-note", "GCC-exception-2.0", "GCC-exception-3.1", } )
Functions ¶
func AreListsMatching ¶
func AreTokensMatching ¶
func CanonicalToAllForms ¶
Produce all non-canonical forms for given canonocal one
func CanonicalToGlobs ¶
func DedupInPlace ¶
DedupInPlace removes duplicates in-place and returns a subslice of the original backing array with duplicates removed, preserving the first occurrence order. This reuses memory (no new slice allocation for elements), O(n) time, O(n) map.
func GetText ¶
Example ¶
package main import ( "fmt" "github.com/asciimoth/licensedb/internal" ) func main() { fmt.Println(internal.GetText("GPL-3.0-only")) }
func GlobToFirstMatch ¶
func HyphenPrefixes ¶
HyphenPrefixes returns cumulative prefixes of s split by '-' but excluding the full original string. Example: "a-b-c-d" -> ["a", "a-b", "a-b-c"]
func SeparateTokenList ¶
func TokenToCanonical ¶
func TokensToCanonical ¶
func TokensToShort ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.