-
Notifications
You must be signed in to change notification settings - Fork 821
wire: use go/packages for analysis #623
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
Conversation
Unfortunately, this does come with a ~4x slowdown to Wire, as it is now pulling source for all transitively depended packages, but not trimming comments or function bodies. This is due to limitations with the ParseFile callback in go/packages. This comes with a single semantic change: when performing analysis, Wire will now evaluate everything with the wireinject build tag. I updated the build tags tests accordingly. I deleted the vendoring test, as vendoring becomes obsolete with modules. go/packages now parses comments by default, so now the generated code includes comments for non-injector declarations. Fixes #78
Tests are failing.... |
Investigating. This is a new failure to me. |
The changes look fine to me, once tests are passing :-).
Can you clarify -- what did it do before? |
Prior to this PR, only the packages directly named by the package patterns would be evaluated with the |
Aren't top-level vendor directories still supported? |
@jba They are, but the semantics as they pertain to Wire have changed: such a vendored directory used to silently be Note to other contributors: please don't merge this yet. I don't have an explanation for the original build failure yet. In the meantime, I have pushed seemingly identical code and the tests passed. :| |
OK, tests pass AFAICT. The Mac failure is legitimate and has been addressed by calling
I am apprehensive that I might be somehow introducing a nondeterministic test. However, I have no plausible hypotheses as to the source of the failure, so I don't know what to log in order to monitor the failure in the future. Possibilities that I've ruled out:
@vangent, please review, but please do not merge. I would like to do another pass at editing the commit message before it goes in. |
Unfortunately, this does come with a ~4x slowdown to Wire, as it is now pulling source for all transitively depended packages, but not trimming comments or function bodies. This is due to limitations with the ParseFile callback in go/packages. This comes with a single semantic change: when performing analysis, Wire will now evaluate everything with the wireinject build tag. I updated the build tags tests accordingly. Prior to this PR, only the packages directly named by the package patterns would be evaluated with the wireinject build tag. Dependencies would not have the wireinject build tag applied. There isn't a way to selectively apply build tags in go/packages, and there isn't a clear benefit to applying it selectively. Being consistent with other Go tooling provides greater benefit. I deleted the vendoring test, as non-top-level vendoring becomes obsolete with modules. go/packages now parses comments by default, so now the generated code includes comments for non-injector declarations. Fixes google/go-cloud#78
Unfortunately, this does come with a ~4x slowdown to Wire, as it is now pulling source for all transitively depended packages, but not trimming comments or function bodies. This is due to limitations with the ParseFile callback in
go/packages
.This comes with a single semantic change: when performing analysis, Wire will now evaluate everything with the wireinject build tag. I updated the build tags tests accordingly.
I deleted the vendoring test, as vendoring becomes obsolete with modules.
go/packages
now parses comments by default, so now the generated code includes comments for non-injector declarations.Fixes #78