-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/exp/cmd/gorelease: expose analysis.Analyzer #44945
Comments
/cc @jayconrod @jadekler |
Jay is for sure the expert here, but
Could you enlighten me as to what this means? You have some existing tool - perhaps gopls - that is doing AST parsing, and you want to feed that AST to gorelease rather than it re-parsing? What is the benefit - some performance gains? If so, how much do you anticipate gaining? Is this a nice-to-have, or blocking your workflow? (I'm pretty ignorant to the broader tooling infrastructure, and trying to learn, so that's where the questions are aimed :) ) |
Sure, so I use
In one of the worst examples, 200k loc, it takes 49s. While That being said, we have a workflow today and with #37561, we could technically automate the reporting much like |
I like the idea of having an analyzer that protects against incompatible changes. Architecturally, I guess this fits in somewhere between The weird bit here I suppose is that the analyzer needs a base version to compare against, which might require downloading a module into the cache. It's fine for |
Yeah, putting this in a new package or apidiff would be fine by me. Also you are not wrong, but it does feel like an |
This would be a fair significant change. analysis.Analyzers work on a single package at a time. These can communicate using Fact edges from imported packages (within the same Analyzer) and Results between Analyzers on the same package. {single,multi}checker.Main() take a list of packages and a list of analyzers and output a a list of Diagnostics (+ some extra output). Packages are loaded using packages.Load(). I am looking into making analysis support running list of root packages.Packages and a list of analysis.Analyzers and returning the Facts and Diagnostics of the root actions. (Exposing Results runs into trouble with unitchecker's requirements.) Calling this would likely happen outside of a {single,multi}checker.Main(). I suspect this is not quite compatible with your all of your goals. The main problem with trying to do this in the analysis package is that it is missing information. You need to load pkg@123 and pkg@234, and encode that there is a relationship between pkg@123 and pkg@234. You will need to make this available to a single Pass, i.e. (Analyzer, Package) pair, that can see all of this information at once. How do you plan on making all of this information available to a Pass? |
It would be a bit of duplication of effort, but I think that, for a given It would be nice to have a module level, I think "root packages.Packages" in your parlance, task that can calculate "latest release" then each package can generate off this, but "fetch latest release" is pretty cheap, and you can still do the ast parsing at the package level for the old version.
|
Frequently I run
gorelease
as part of ci to test if anybody has introduced breaking changes. This works well, but is a separate workflow that I have to run in addition to all the linting that already goes on. It would be nice if I could simply add a phase to my current run of[]*analysis.Analyzer
and reuse the parsing that is already done.IIUC, this would require fetching the previous versions' AST as an
analysis.Fact
, so I am neither sure how feasible or efficient this would be, but it would serve to be better integrable into existing metalinters.EDIT: This may be of less value after #37561, but reparsing the AST does come at cost, so it would be a nice to have regardless.
The text was updated successfully, but these errors were encountered: