Giter VIP home page Giter VIP logo

go-license-1's Introduction

go-license

go-license is a tool that ensures that a license header is applied to Go files.

Usage

Run ./go-license --config=license.yml [files] to apply the license specified by the configuration in license.yml to all of the specified files (only the files that end in .go and are not excluded by configuration are processed).

Run ./go-license --config=license.yml --remove [files] to remove the license specified by the configuration in license.yml from all of the specified files (only the files that end in .go and are not excluded by configuration are processed).

Run ./go-license --config=license.yml --verify [files] to verify that the license specified by the configuration is applied to all of the specified files *.go files (only the files that end in .go and are not excluded by configuration are processed). If the license is not applied properly to any of the files, the files that do not match are printed and the program exits with a non-0 exit code.

Configuration

The configuration file specifies the header that should be applied as a header key. It also supports an exclude parameter that specifies files or paths that should be excluded from configuration.

Here is an example configuration file:

header: |
  // Copyright {{YEAR}} Palantir Technologies, Inc.
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.

custom-headers:
  - name: subproject
    header: |
      // Copyright 2016 Palantir Technologies, Inc. All rights reserved.
      // Subproject license.

    paths:
      - subprojectDir
exclude:
  exclude-names:
    - "vendor"

The string {{YEAR}} indicates that, when a license is added by the tool, the current year will be used. For operations that match licenses (for verification or removal), {{YEAR}} will match any 4-digit number.

The custom-headers configuration allows custom headers to be specified for matching names or paths.

go-license-1's People

Contributors

nmiyake avatar svc-excavator-bot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.