chklicenses
A go dependency license checker.
This is thin a wrapper around google's license classifier forked from go-license with a few extra options.
Installation
# install the latest version to ./bin
curl -sSfL https://raw.githubusercontent.com/khulnasoft/chk-licenses/master/chklicenses.sh | sh
# install a specific version to another directory
curl -sSfL https://raw.githubusercontent.com/khulnasoft/chk-licenses/master/chklicenses.sh | sh -s -- -b ./path/to/bin v1.26.0
Usage
# list the licenses of all of your dependencies...
chklicenses list # ... from ./go.mod
chklicenses list ~/some/path # ... from ~/some/path/go.mod
chklicenses list github.com/some/repo # ... from a remote repo
# pass/fail of user-specified license restrictions (by .chklicenses.yaml)
chklicenses check
chklicenses check ~/some/path
chklicenses check github.com/some/repo
The .chklicenses.yaml
can specify a simple allow-list or deny-list license name regex patterns (by SPDX name):
permit:
- BSD.*
- MIT.*
- Apache.*
- MPL.*
forbid:
- GPL.*
ignore-packages:
- github.com/some/repo
forbid:
- GPL.*
Note: either allow or deny lists can be specified, not both.