go-license-header is a simple CLI tool for checking and generating license headers in Go files. It supports MPL, GPL, LGPL and AGPL licenses.
go-license-header checks and generates license headers in Go files.
Usage:
go-license-header help
Prints out this help message.
go-license-header header [-spdx] -n [-y] -c
Prints out an example *GPL file header.
-spdx=<id> SPDX license identifier. (default: MPL-2.0)
-n=<name> Project name. (required)
-y=<year> Year. (default: {current year})
-c=<copy> Copyright holder. (required)
go-license-header license [-spdx] [-o] [-d]
Prints out the license files linked to the SPDX License Identifier.
If [-o] is specified, it will also try to write it to that directory.
-spdx=<id> SPDX license identifier. (default: MPL-2.0)
-o=<dir> Output directory.
-d Dry-run flag, will print the write locations.
go-license-header check [-spdx] [-p] [-r] [-d]
Checks if all files in the given path have a license header.
Will look for '.license.header' otherwise, [-n] and [-c] need to be specified.
-spdx=<id> SPDX license identifier. (default: MPL-2.0)
-p=<path> The path to check, can be either a file or directory (with -r).
-r Whether to recursively walk the directory.
-d Dry-run flag, will print error but not exit(1).
-n=<name> Project name.
-y=<year> Year. (default: {current year})
-c=<copy> Copyright holder.
go-license-header run [-spdx] [-p] [-r] [-d]
Writes license headers to files that don't have one yet.
Will look for '.license.header' otherwise, [-n] and [-c] need to be specified.
-spdx=<id> SPDX license identifier. (default: MPL-2.0)
-p=<path> The path to check, can be either a file or directory (with -r).
-r Whether to recursively walk the directory.
-d Dry-run flag, will print error but not write the headers.
-n=<name> Project name.
-y=<year> Year. (default: {current year})
-c=<copy> Copyright holder.
- MPL-2.0
- GPL-2.0-only
- GPL-2.0-or-later
- GPL-3.0-only
- GPL-3.0-or-later
- LGPL-2.1-only
- LGPL-2.1-or-later
- LGPL-3.0-only
- LGPL-3.0-or-later
- AGPL-3.0-only
- AGPL-3.0-or-later