Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshdk/licensor
📝 Detect what license a project is distributed under
https://github.com/joshdk/licensor
compliance golang license license-checking license-management license-scan licenses oss oss-compliance spdx spdx-license
Last synced: about 5 hours ago
JSON representation
📝 Detect what license a project is distributed under
- Host: GitHub
- URL: https://github.com/joshdk/licensor
- Owner: joshdk
- License: mit
- Created: 2017-12-03T06:03:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-11T16:12:08.000Z (about 6 years ago)
- Last Synced: 2024-06-21T09:03:14.077Z (5 months ago)
- Topics: compliance, golang, license, license-checking, license-management, license-scan, licenses, oss, oss-compliance, spdx, spdx-license
- Language: Shell
- Homepage:
- Size: 14 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![License](https://img.shields.io/github/license/joshdk/licensor.svg)](https://opensource.org/licenses/MIT)
[![GoDoc](https://godoc.org/github.com/joshdk/licensor?status.svg)](https://godoc.org/github.com/joshdk/licensor)
[![Go Report Card](https://goreportcard.com/badge/github.com/joshdk/licensor)](https://goreportcard.com/report/github.com/joshdk/licensor)
[![CircleCI](https://circleci.com/gh/joshdk/licensor.svg?&style=shield)](https://circleci.com/gh/joshdk/licensor/tree/master)# Licensor
📝 Detect what license a project is distributed under
## Installing
You can fetch this library by running the following
go get -u github.com/joshdk/licensor
## Usage
```go
import (
"fmt"
"github.com/joshdk/licensor"
)// Example content from https://github.com/golang/go/blob/master/LICENSE
const unknown = `
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
...
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
`// Find license that is the closest match
match := licensor.Best([]byte(unknown))fmt.Printf("License name: %s\n", match.License.Name)
fmt.Printf("SPDX identifier: %s\n", match.License.Identifier)
fmt.Printf("Match confidence: %.2f\n", match.Confidence)
// License name: BSD 3-clause "New" or "Revised" License
// SPDX identifier: BSD-3-Clause
// Match confidence: 0.96
```## License
This library is distributed under the [MIT License](https://opensource.org/licenses/MIT), see LICENSE.txt for more information.