-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
go/packages: allow types loading without NeedDeps #139
Conversation
This PR (HEAD: 2a85316) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
Message from Gobot Gobot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Looks like it fixes golang/go#31699 too, /cc @matloob |
Thanks for this PR. It also fixes golang/go#31930. Now seeing run times and alloc_space profiles cut about in half for my use case, allowing me to query for types info and LoadSyntax but w/o the mandatory LoadSyntaxAll cost of parsing standard libraries, etc. that were not the target of the Load query. |
3ae24b8
to
979bdb7
Compare
This PR (HEAD: 3ae24b8) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
This PR (HEAD: 979bdb7) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
I've resolved merge conflicts. |
Message from Michael Matloob: Patch Set 3: (2 comments) I agree we should fix the issue where we load everything from source, even if the user doesn't need it, but I don't want to change the meaning of the NeedX fields. Here's my idea to fix this (which I think should require minimal changes to your CL): Have the loader keep a separate set of "implied" NeedX bits, called, say, "impliedMode". Then addDependingLoadModes can set impliedMode instead of modifying ld.Mode directly. Because the loader keeps the original mode, it can then clear the bits the same way it was doing before this change. What do you think? Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Before separating Load* into Need* we could use LoadSyntax to get types information by loading inital packages from source code and loading it's direct dependencies from export data. It was broken when separation was introduced and before this commit everything was loading from source code what resulted into slow loading times. This commit fixes it. Also, do backwards-incompatible fix of definition of deprecated LoadImports and LoadAllSyntax. Improve an internal error message "internal error: nil Pkg importing x from y": replace it with "internal error: package x without types was imported from y". Remove packages.NeedDeps request for loading in tests TestLoadTypesBits and TestContainsOverlayXTest. Fixes golang/go#31752, fixes golang/go#33077, fixes golang/go#32814, fixes golang/go#31699, fixes golang/go#31930
This PR (HEAD: 08e470e) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
Save the actually requested fields in loader.requestedMode. loader.Mode contains the implied mode (see implyLoadMode): all the fields we need the data for. Zero out unrequested fields before returning packages to the user by checking loader.requestedMode.
This PR (HEAD: 3540c02) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
Message from Denis Isaev: Patch Set 5: Thank you for your comments! I've removed information about implied modes from Need* comments. And I've created requestedMode to save actually requested mode. Adding impliedMode will be much more difficult because: Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Message from Michael Matloob: Patch Set 5: (2 comments)
Sounds good! just a couple of comments about the impliedMode function Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Message from Michael Matloob: Patch Set 5: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
This PR (HEAD: f015199) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
Message from Denis Isaev: Patch Set 6: (3 comments) thank you for the review, I've fixed all comments, but it required me to do a lot of changes. Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Message from Michael Matloob: Patch Set 6: (1 comment) Hi, sorry this review is taking so long. Could you revert the changes you made in your most recent patch set (except for making impliedMode a function)? I'll submit that change and we can work on the rest in a separate review. Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
This PR (HEAD: 2e3a46e) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/186337 to see it. Tip: You can toggle comments from me using the |
Message from Denis Isaev: Patch Set 6: ok, I've reverted the last change and left only impliedLoadMode function refactoring. Please, take a look at it again. Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Message from Michael Matloob: Patch Set 7: Code-Review+2 (1 comment) one more small thing Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Message from Denis Isaev: Patch Set 7: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/186337. |
Before separating Load* into Need* we could use LoadSyntax to get types information by loading inital packages from source code and loading it's direct dependencies from export data. It was broken when separation was introduced and before this commit everything was loading from source code what resulted into slow loading times. This commit fixes it. Also, do backwards-incompatible fix of definition of deprecated LoadImports and LoadAllSyntax. Improve an internal error message "internal error: nil Pkg importing x from y": replace it with "internal error: package x without types was imported from y". Remove packages.NeedDeps request for loading in tests TestLoadTypesBits and TestContainsOverlayXTest. Fixes golang/go#31752, fixes golang/go#33077, fixes golang/go#32814, fixes golang/go#31699, fixes golang/go#31930 Change-Id: I416e3c1035d555d67039e45a4fdd1deb9b2184ef GitHub-Last-Rev: 2e3a46e GitHub-Pull-Request: #139 Reviewed-on: https://go-review.googlesource.com/c/tools/+/186337 Reviewed-by: Michael Matloob <matloob@golang.org>
This PR is being closed because golang.org/cl/186337 has been merged. |
* Update to ultraware/funlen v0.0.2. Fixes ultraware/funlen#1. * Update to latest golang.org/x/tools. Fixes #687. Fixes golang/tools#139.
Before separating Load* into Need* we could use LoadSyntax to get types information by loading inital packages from source code and loading it's direct dependencies from export data. It was broken when separation was introduced and before this commit everything was loading from source code what resulted into slow loading times. This commit fixes it. Also, do backwards-incompatible fix of definition of deprecated LoadImports and LoadAllSyntax. Improve an internal error message "internal error: nil Pkg importing x from y": replace it with "internal error: package x without types was imported from y". Remove packages.NeedDeps request for loading in tests TestLoadTypesBits and TestContainsOverlayXTest. Fixes golang/go#31752, fixes golang/go#33077, fixes golang/go#32814, fixes golang/go#31699, fixes golang/go#31930 Change-Id: I416e3c1035d555d67039e45a4fdd1deb9b2184ef GitHub-Last-Rev: 2e3a46e GitHub-Pull-Request: golang#139 Reviewed-on: https://go-review.googlesource.com/c/tools/+/186337 Reviewed-by: Michael Matloob <matloob@golang.org>
Before separating Load* into Need* we could use LoadSyntax
to get types information by loading inital packages
from source code and loading it's direct dependencies from export data.
It was broken when separation was introduced and before this commit
everything was loading from source code what resulted into slow
loading times. This commit fixes it.
Also, do backwards-incompatible fix of definition of deprecated
LoadImports and LoadAllSyntax.
Improve an internal error message
"internal error: nil Pkg importing x from y": replace it with
"internal error: package x without types was imported from y".
Remove packages.NeedDeps request for loading in tests
TestLoadTypesBits and TestContainsOverlayXTest.
Fixes golang/go#31752, fixes golang/go#33077, fixes golang/go#32814,
fixes golang/go#31699, fixes golang/go#31930