internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

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 AreListsMatching(a, b []string) bool

func AreTokensListsMatchingSwap

func AreTokensListsMatchingSwap(a, b []string) bool

func AreTokensMatching

func AreTokensMatching(a, b string) bool

func CanonicalToAllForms

func CanonicalToAllForms(canonical string) (forms []string)

Produce all non-canonical forms for given canonocal one

func CanonicalToGlobs

func CanonicalToGlobs(canonical string) (globs []string)

func DedupInPlace

func DedupInPlace(ss []string) []string

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 GetGlobs

func GetGlobs(token string) []string

func GetText

func GetText(name string) *string
Example
package main

import (
	"fmt"

	"github.com/asciimoth/licensedb/internal"
)

func main() {
	fmt.Println(internal.GetText("GPL-3.0-only"))
}

func GlobToFirstMatch

func GlobToFirstMatch(glob string) string

func HyphenPrefixes

func HyphenPrefixes(s string) []string

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 List

func List() []string

func SeparateTokenList

func SeparateTokenList(tokens []string) (licenses, exceptions []string)

func ToShort

func ToShort(text string) string

func TokenToCanonical

func TokenToCanonical(token string) string

func Tokenise

func Tokenise(text string) []string

func TokensToCanonical

func TokensToCanonical(tokens []string) []string

func TokensToShort

func TokensToShort(tokens []string) map[string]string

Types

This section is empty.

Jump to

Keyboard shortcuts

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