spdx

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const SPDXDownloadURL = "https://raw.githubusercontent.com/spdx/license-list-data/refs/heads/main/json/licenses.json"

SPDXDownloadURL is the URL to download the SPDX licenses JSON file.

View Source
const SPDXFilename = "licenses.json"

SPDXFilename is the name of the SPDX licenses JSON file.

Variables

This section is empty.

Functions

This section is empty.

Types

type License

type License struct {
	Reference             string   `json:"reference"`
	IsDeprecatedLicenseID bool     `json:"isDeprecatedLicenseId"`
	DetailsURL            string   `json:"detailsUrl"`
	ReferenceNumber       int      `json:"referenceNumber"`
	Name                  string   `json:"name"`
	LicenseID             string   `json:"licenseId"`
	SeeAlso               []string `json:"seeAlso"`
	IsOsiApproved         bool     `json:"isOsiApproved"`
	IsFsfLibre            bool     `json:"isFsfLibre"`
}

func FetchAll

func FetchAll() ([]License, error)

FetchAll fetches the SPDX licenses from GitHub.

func LoadBuiltin

func LoadBuiltin() ([]License, error)

LoadBuiltin loads the SPDX metadata from the embedded SPDX catalog.

Example
package main

import (
	"fmt"

	"github.com/front-matter/commonmeta/spdx"
)

func main() {
	licenses, _ := spdx.LoadBuiltin()
	s := licenses[65].LicenseID
	fmt.Println(s)
}
Output:
BSD-1-Clause
func Search(id string) (License, error)

Search searches local SPDX metadata for a given spdx licenseId or url.

type SPDX

type SPDX struct {
	LicenseListVersion string    `json:"licenseListVersion"`
	LicenseList        []License `json:"licenses"`
	ReleaseDate        string    `json:"releaseDate"`
}

func LoadJSON

func LoadJSON(version string) ([]SPDX, error)

LoadJSON loads a local licenses json file.

Jump to

Keyboard shortcuts

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