spdx

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

README

spdx-go

Build Report Card GoDoc Slack

A simple Golang library that contains license information from SPDX.

See spdx.org/licenses for more details.

if license, ok := spdx.LicenseForID("apache-2.0"); ok {
    fmt.Println(license.ID())         // Apache-2.0
    fmt.Println(license.Name())       // Apache License 2.0
    fmt.Println(license.Reference())  // https://spdx.org/licenses/Apache-2.0.html
    fmt.Println(license.DetailsURL()) // https://spdx.org/licenses/Apache-2.0.json
}

for _, license := range spdx.AllLicenses() {
    fmt.Println(license)
}

Status: Beta

This repository is still in beta, however will be promoted to stable very soon.

The original data is sourced from SPDX.

This library is offered under the Apache 2 license.

Documentation

Overview

Package spdx contains license information from SPDX.

See https://spdx.org/licenses.

Index

Constants

View Source
const LicenseListVersion = "v3.23"

LicenseListVersion is the version of the SPDX license list.

See https://spdx.org/licenses.

Variables

This section is empty.

Functions

This section is empty.

Types

type License

type License struct {
	// ID is the SPDX ID of the license.
	ID string `json:"licenseId,omitempty"`
	// Name is the full license name.
	Name string `json:"name,omitempty"`
	// Reference is the URL that contains the reference documentation for the license.
	Reference string `json:"reference,omitempty"`
	// ReferenceNumber is the license reference number.
	ReferenceNumber int `json:"referenceNumber,omitempty"`
	// DetsilsURL is the URL that contains extra details on the license.
	DetailsURL string `json:"detailsUrl,omitempty"`
	// Deprecated indicates whether the license ID is deprecated.
	Deprecated bool `json:"isDeprecatedLicenceId,omitempty"`
	// SellAlso are additional URLs where the licensecan be found in use.
	SeeAlso []string `json:"seeAlso,omitempty"`
	// OSIApproved indicates whether the complies with the Open Source Definition and is approved
	// by the Open Source Initiative.
	OSIApproved bool `json:"isOsiApproved,omitempty"`
}

License is a SPDX license.

func AllLicenses added in v0.2.0

func AllLicenses() []License

AllLicenses returns a slice of all Licenses.

This slice will be sorted by License ID.

func LicenseForID

func LicenseForID(id string) (License, bool)

LicenseForID returns the License for the ID.

The input ID is case-insensitive, that is any casing of the ID will result in the correct License.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳