Repository navigation
Limit nilaway to the main module by default - #39
Merged
Merged
Conversation
A flag default can name a package, and only the loaded packages say whether the default is right. nilaway's -include-pkgs wants the main module of the run, which neither the working directory nor a flag parse reveals: a workspace holds several main modules, and a pattern can point at a module that is not the current one. Add a hook that the command supplies and the driver calls after loading, in the analysis path and in the fix path. No command supplies a hook yet, so no flag changes. The test pins the order: the hook runs before the analyzers, and it sees the loaded roots and their modules. Change-Id: If8fdf9c1deeca15f4f8d6919e6060541a040dbfd
The analyzers asked whether a file is generated, but what they do with the answer is skip its diagnostics. Rename the predicate in the signature change, not in a behavior change. The next commit adds a flag that turns the skip off, and a name that states the decision keeps the call site honest about which question the flag answers. Change-Id: Id1f81ecea1ae760033b52724574db7f9c2a0d44d
NilAway reads every package that it loads, so a run over one module also builds the SSA form of the standard library and of every dependency. That costs seconds and gigabytes, and it reports flows that the analyzed repository cannot fix: a nil value inside the standard library belongs to Go, not to the code under review. Set -include-pkgs to the main modules of the loaded packages. The driver hook supplies them, because a workspace has several main modules and a pattern can name a module other than the current one. A reader who wants the old scope sets -nilaway.include-all-pkgs, and an explicit -nilaway_config.include-pkgs keeps the packages that it names. Widening the scope exposes two code sites that the narrow run never reaches, because it needs a fact about a standard library package. The driver test now guards each flag lookup, and the fix pass builds its map instead of cloning one that can be nil. The hook no longer needs the flag on its command line, so the command returns to the plain form. Change-Id: I1ef0782ba71084540c610bc5064ba595167d6f62
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.