license

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Using the GitHub API to get the license information and license text.

Reference: https://choosealicense.com/licenses

Index

Constants

View Source
const (
	LICENSE_LIST = "license.json"
	BASE_URL     = "https://raw.githubusercontent.com/caffeine-addictt/waku/%s/licenses/"
)

Variables

View Source
var Licenses *[]License

The global "cache" per say so we only need to hit the endpoint once per session.

Functions

func GetLicenseFetchUrl added in v0.7.0

func GetLicenseFetchUrl() string

func GetLicenses

func GetLicenses() (*[]License, error)

GetLicenses returns the list of licenses from the GitHub API or returns the cached list if it exists.

Types

type License

type License struct {
	// This is the full name of the License.
	// Example: "MIT License"
	Name string `json:"name"`

	// This is the SPDX ID of the License.
	// Example: "MIT"
	Spdx string `json:"spdx"`

	// The filename in 'licenses/'
	Filename string `json:"filename"`

	// That values the license wants
	Wants LicenseWants `json:"wants"`
}

Returned from the licenses/ directory.

func (*License) GetLicenseText

func (license *License) GetLicenseText() (string, error)

type LicenseWants

type LicenseWants []string

func (*LicenseWants) UnmarshalJSON

func (l *LicenseWants) UnmarshalJSON(data []byte) error

Will clean up license wants

Jump to

Keyboard shortcuts

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