-
Notifications
You must be signed in to change notification settings - Fork 3.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
ui: add empty go.mod files to workspaces #99775
Merged
Merged
Conversation
This file contains 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
knz
approved these changes
Mar 31, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thank you
Some go tools such as go list end up traversing directories that don't have go.mod files, looking for go packages. If you happen to have built the UI recently, that means about tens of thousands of extra stat calls. On macOS, this is very expensive, even with warm caches. For example: ``` time go list -modfile=go.mod -mod=readonly -e ARGS_ELIDED -- builtin github.com/cockroachdb/cockroach/... > /dev/null 2>&1 real 0m28.309s user 0m23.541s sys 0m50.926s > for i in pkg/ui/workspaces/*/; do touch $i/go.mod; done > time go list -modfile=go.mod -mod=readonly -e ARGS_ELIDED -- builtin github.com/cockroachdb/cockroach/... > /dev/null 2>&1 real 0m13.074s user 0m18.282s sys 0m19.324s ``` The go list command I used was taken from what I observed gopls running at startup. On Linux, the impact relatively modest. I could avoid building the UI, but I like the UI. Epic: none Release note: none
bors r=knz |
Build succeeded: |
craig bot
pushed a commit
that referenced
this pull request
Nov 8, 2024
`go list` (which is invoked occasionally GoLand) throws a "missing module declaration" error on the empty `go.mod` files that were created in #99775 (to prevent `go list` from recursing into subdirectories to save IO). Now we make actual empty named modules, which seems to work better. ``` for i in pkg/ui/workspaces/*/ do echo "module $(basename $i | sed 's/[^a-z]//g')" > $i/go.mod done ``` Epic: none
craig bot
pushed a commit
that referenced
this pull request
Nov 8, 2024
127867: workspaces: create actual dummy go modules r=tbg a=tbg `go list` (which is invoked occasionally GoLand) throws a "missing module declaration" error on the empty `go.mod` files that were created in #99775 (to prevent `go list` from recursing into subdirectories to save IO). Now we make actual empty named modules, which seems to work better. ``` for i in pkg/ui/workspaces/*/ do echo "module $(basename $i | sed 's/[^a-z]//g')" > $i/go.mod done ``` Epic: none Co-authored-by: Tobias Grieger <[email protected]>
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.
Some go tools such as go list end up traversing directories that don't have go.mod files, looking for go packages.
If you happen to have built the UI recently, that means tens of thousands of extra stat calls.
On macOS, this is very expensive, even with warm caches.
For example:
The go list command I used was taken from what I observed gopls running at startup.
On Linux, the impact relatively modest.
I could avoid building the UI, but I like the UI.
Epic: none
Release note: none