import-restrictions

command module
v0.0.0-...-7e04b63 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

import-restrictions

Restrict imports in your go project.

This tools helps maintainers keep dependencies clean when they have multiple packages inside the same repo that shouldn't depend on each other.

Usage

By default this tool will search for a configuration file named import-restrictions.yaml in the current directory, you can give it another configuration file with the flag --configuration.

$ import-restrictions
$ import-restrictions --configuration my-configuration-file.yaml

Configuration

The configuration file is a yaml file with an array of objects that must contain:

  • dir the base directory of the package
  • forbiddenImports a list of packages that are forbidden for all the packages inside dir.

For example:

- dir: ./cmd
  forbiddenImports:
    - bytes
    - github.com/account/repo

The configuration is pretty self-explanatory, with a configuration file like the one above all the packages inside the directory cmd cannot import any of the bytes and github.com/account/repo packages.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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