project-gadgets

module
v0.0.0-...-3ed7c7a Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0

README

Project Gadgets

AppVeyor GolangCI Go Report Card codecov Release

Tools

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"
  ]
}

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

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