https://github.com/docker-archive-public/docker.import-restrictions
Restrict imports in your go project
https://github.com/docker-archive-public/docker.import-restrictions
Last synced: 9 months ago
JSON representation
Restrict imports in your go project
- Host: GitHub
- URL: https://github.com/docker-archive-public/docker.import-restrictions
- Owner: docker
- License: apache-2.0
- Archived: true
- Created: 2020-08-18T13:24:08.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2020-08-20T15:45:13.000Z (almost 6 years ago)
- Last Synced: 2024-09-14T09:41:28.050Z (almost 2 years ago)
- Language: Go
- Size: 14.6 KB
- Stars: 9
- Watchers: 12
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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`.
```sh
$ 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:
```yaml
- 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.