Project Gadgets
![Release](https://img.shields.io/github/release/dunbit/project-gadgets.svg?style=flat-square)
check-license
Install
Execute the following command to quickly install the check-license binary.
go get -u github.com/dunbit/project-gadgets/cmd/check-license
Usage
Validate Command
To validate the license headers in source files, run check-license with validate command.
check-license validate -config ./path/to/config.yaml
The command will:
- Exit(0) - When all licenses are matching template.
- Exit(1) - When one or more licenses are not matching template. Console message will display which files failed.
Version Command
To know the build version run:
check-license version
Config file
Example YAML config file:
check-license validate -config ./path/to/config.yaml
license:
path: "./template.txt" # Path to the license template
files:
- match: "*.go" # Define Extension
comment: "//" # Define comment style
- match: "Makefile" # Define Filename
comment: "#" # Define comment style
excludes:
- "./api/**/*.pb.go" # Exclude files generated by protoc compiler
- "./vendor" # Exclude vendor packages
Example JSON config file:
check-license validate -config ./path/to/config.json
{
"license": {
"path": "./template.txt"
},
"files": [
{
"match": "*.go",
"comment": "//"
},
{
"match": "Makefile",
"comment": "#"
}
],
"excludes": [
"./api/**/*.pb.go",
"./vendor"
]
}