Open jbedard opened 1 month ago
Just to re-iterate a few points and limitations of this:
This is EXPERIMENTAL with no api guarantees. 99% chance there will be breaking changes. You should never commit this file to source-control.
When this EXPERIMENTAL feature is used:
resolver.Imports/Embeds()
calls for the entire workspace (the "rule index") is written to disk dirs
(default: .
) on the command line only those directories are updated in the "rule index"dirs
specified on the command line will be traversed, therefore:
dirs
will have Imports/Embeds()
invokeddirs
will have Fix()
, GenerateRules()
invokeddirs
will have BUILDs updated, warnings generated etc.dirs
will have things like resolve warnings outputtedIf resolver.Imports/Embeds()
have side-effects then this won't work very well when they are cached and not invoked. Don't do that.
There is no cache invalidation here. It is entirely up to the user to pass the correct list of dirs
that require reprocessing.
FUTURE: if those updated dirs
changed what rules they generate and the Imports/Embeds()
of those rules change it is possible that other rules outside dirs
are now referencing something incorrect. I think if Imports/Embeds()
of those dirs
change we might want to re-run Fix
+ GenerateRules
for all directories.
What type of PR is this? Feature
What package or component does this PR mostly affect? cmd/gazelle
What does this PR do? Why is it needed?
Add the ability to persist the
RuleIndex
across runs to allow updating only the specified directories when indexing is required.Which issues(s) does this PR fix?
Ref: #1181