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 LoadBuiltin ¶
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 ¶
Search searches local SPDX metadata for a given spdx licenseId or url.
Example ¶
package main
import (
"fmt"
"github.com/front-matter/commonmeta/spdx"
)
func main() {
license, _ := spdx.Search("CC-BY-4.0")
s := license.Name
fmt.Println(s)
}
Output: Creative Commons Attribution 4.0 International
Click to show internal directories.
Click to hide internal directories.