Skip to content

A simple Golang library that contains license information from SPDX.

License

Notifications You must be signed in to change notification settings

bufbuild/spdx-go

Repository files navigation

spdx-go

Build Report Card GoDoc Slack

A simple Golang library that contains license information from SPDX.

See spdx.org/licenses for more details.

import (
	"buf.build/go/spdx"
)

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.ReferenceNumber) // 501
	fmt.Println(license.DetailsURL)      // https://spdx.org/licenses/Apache-2.0.json
	fmt.Println(license.Deprecated)      // false
	fmt.Println(license.SeeAlso)         // [https://www.apache.org/licenses/LICENSE-2.0 https://opensource.org/licenses/Apache-2.0]
	fmt.Println(license.OSIApproved)     // true
}

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

Status: Beta

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

Legal

The original data is sourced from SPDX.

This library is offered under the Apache 2 license.