Enforce restrictions on dependency relationships between packages #8284
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enforce whitelist-based restrictions on the dependency relationship between packages. This allows us to ensure that undesirable dependency relationships are not introduced.
The enforcement works by enumerating the go packages, finding the applicable
.godeps_rules
file (looking first in the package's directory, then looking recursively in parent directories, and finally falling back to/dev/null
— essentially "default deny"). Each rules file is a list of regular expressions to be evaluated bygrep
(with support for full-line#
-prefixed comments).The enforcement script leverages the existing
go-deps.sh
script, including its caching logic (enabled by settingVIC_CACHE_DEPS
, purged viamake cleandeps
).Careful review of PRs that introduce or modify rule files will be necessary for this enforcement to be as effective as possible.
Fixes #8203
I've created #8294 to track resolution of existing undesirable dependency relationships.
Please review both the enforcement script itself and the initial dependency rules, which are written by hand based on my understanding of the codebase and may have errors as a result.