github.com/docker/import-restrictions@v0.0.0-20200820154456-7e04b6301b4d/README.md (about) 1 # import-restrictions 2 3 Restrict imports in your go project. 4 5 This tools helps maintainers keep dependencies clean when they have multiple packages inside the same repo that shouldn't depend on each other. 6 7 ## Usage 8 9 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`. 10 11 ```sh 12 $ import-restrictions 13 $ import-restrictions --configuration my-configuration-file.yaml 14 ``` 15 16 ## Configuration 17 18 The configuration file is a yaml file with an array of objects that must contain: 19 20 - `dir` the base directory of the package 21 - `forbiddenImports` a list of packages that are forbidden for all the packages inside `dir`. 22 23 For example: 24 25 ```yaml 26 - dir: ./cmd 27 forbiddenImports: 28 - bytes 29 - github.com/account/repo 30 ``` 31 32 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.