-
Notifications
You must be signed in to change notification settings - Fork 365
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
language/go: introduce static dependency resolution mode #1201
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
linzhp
reviewed
Mar 16, 2022
linzhp
approved these changes
Mar 17, 2022
This was referenced Apr 24, 2022
This was referenced Oct 19, 2022
l46kok
added a commit
to l46kok/cel-go
that referenced
this pull request
Jan 25, 2023
See bazelbuild/bazel-gazelle#1201 results: ``` % time bazel build ... INFO: Analyzed 49 targets (0 packages loaded, 0 targets configured). INFO: Found 49 targets... INFO: Elapsed time: 20.776s, Critical Path: 20.33s INFO: 138 processes: 3 internal, 135 linux-sandbox. INFO: Build completed successfully, 138 total actions bazel build ... 0.01s user 0.01s system 0% cpu 20.797 total ```
l46kok
added a commit
to l46kok/cel-go
that referenced
this pull request
Jan 25, 2023
See bazelbuild/bazel-gazelle#1201 results: ``` % time bazel build ... INFO: Analyzed 49 targets (0 packages loaded, 0 targets configured). INFO: Found 49 targets... INFO: Elapsed time: 20.776s, Critical Path: 20.33s INFO: 138 processes: 3 internal, 135 linux-sandbox. INFO: Build completed successfully, 138 total actions bazel build ... 0.01s user 0.01s system 0% cpu 20.797 total ```
TristonianJones
pushed a commit
to google/cel-go
that referenced
this pull request
Jan 25, 2023
See bazelbuild/bazel-gazelle#1201 results: ``` % time bazel build ... INFO: Analyzed 49 targets (0 packages loaded, 0 targets configured). INFO: Found 49 targets... INFO: Elapsed time: 20.776s, Critical Path: 20.33s INFO: 138 processes: 3 internal, 135 linux-sandbox. INFO: Build completed successfully, 138 total actions bazel build ... 0.01s user 0.01s system 0% cpu 20.797 total ```
malt3
added a commit
to malt3/bazeldnf
that referenced
this pull request
Feb 2, 2023
Consult the following resources for more information: - bazelbuild/bazel-gazelle#1217 - bazelbuild/bazel-gazelle#1264 - bazelbuild/bazel-gazelle#1201 TL;DR: When using recent versions of gazelle, the newer dependency resolution mode "static" is used by default. This especially fails for golang.org/x/... and when using a macro (_maybe) for the go_repository rules [1]. To avoid the issue, set build mode to external for now. [1] bazelbuild/bazel-gazelle#1217 (comment)
malt3
added a commit
to malt3/bazeldnf
that referenced
this pull request
Feb 2, 2023
Consult the following resources for more information: - bazelbuild/bazel-gazelle#1217 - bazelbuild/bazel-gazelle#1264 - bazelbuild/bazel-gazelle#1201 TL;DR: When using recent versions of gazelle, the newer dependency resolution mode "static" is used by default. This especially fails for golang.org/x/... and when using a macro (_maybe) for the go_repository rules [1]. To avoid the issue, set build mode to external for now. [1] bazelbuild/bazel-gazelle#1217 (comment)
malt3
added a commit
to malt3/bazeldnf
that referenced
this pull request
Feb 2, 2023
Consult the following resources for more information: - bazelbuild/bazel-gazelle#1217 - bazelbuild/bazel-gazelle#1264 - bazelbuild/bazel-gazelle#1201 TL;DR: When using recent versions of gazelle, the newer dependency resolution mode "static" is used by default. This especially fails for golang.org/x/... and when using a macro (_maybe) for the go_repository rules [1]. To avoid the issue, set build mode to external for now. [1] bazelbuild/bazel-gazelle#1217 (comment)
malt3
added a commit
to malt3/bazeldnf
that referenced
this pull request
Feb 2, 2023
Consult the following resources for more information: - bazelbuild/bazel-gazelle#1217 - bazelbuild/bazel-gazelle#1264 - bazelbuild/bazel-gazelle#1201 TL;DR: When using recent versions of gazelle, the newer dependency resolution mode "static" is used by default. This especially fails for golang.org/x/... and when using a macro (_maybe) for the go_repository rules [1]. To avoid the issue, set build mode to external for now. [1] bazelbuild/bazel-gazelle#1217 (comment)
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.
What type of PR is this?
Feature
What package or component does this PR mostly affect?
language/go
repo
go_repository
What does this PR do? Why is it needed?
Creates a new
dependencyMode
calledstatic
, which avoids going out to the network when resolving imports to external labels and instead solely relies on the dependencies Gazelle knows about within WORKSPACE. If no matching dependency is found, Gazelle will skip generating a label for it.This can greatly improve the performance of
go_repository
rules by eliminating unnecessary network calls when an external dependency contains importpaths that are not used within the main repository (and therefore not needed).static
is now the defaultdependencyMode
forgo_repository
rules, given that all known dependencies can be provided via WORKSPACE, and any needed unknown dependencies should already result in build failure.Which issues(s) does this PR fix?
Fixes #602
Other notes for review
A rough experiment shows in
static
mode it took ago_repository
rule forgithub.com/docker/docker
~16.5s to fetch, compared to ~633 seconds inexternal
mode: