-
Notifications
You must be signed in to change notification settings - Fork 381
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
Fix Bazel module resolution regression in go_deps #1966
Conversation
@Buzz-Lightyear Could you review this? |
2a65ce8 made it so that Bazel modules would no longer override Go modules if their versions don't match exactly. Also do not report version mismatches for overridden Bazel modules.
1f32ce2
to
d45893b
Compare
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.
LGTM
# Only use the Bazel module if it is at least as high as the required Go module version. | ||
if path in module_resolutions and bazel_dep.version != module_resolutions[path].version: | ||
# Do not report version mismatches for overridden Bazel modules. | ||
if path in module_resolutions and bazel_dep.version != _HIGHEST_VERSION_SENTINEL and bazel_dep.version != module_resolutions[path].version: | ||
outdated_direct_dep_printer("\n\nMismatch between versions requested for module {module}\nBazel dependency version requested in MODULE.bazel: {bazel_dep_version}\nGo module version requested in go.mod: {go_module_version}\nPlease resolve this mismatch to prevent discrepancies between native Go and Bazel builds\n\n".format( |
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.
Is it expected that this DEBUG
print also happens when the dep in go.mod
is indirect?
To give a concrete example, we have cel.dev/expr v0.18.0 // indirect
in go.mod
, and 0.15.0
in bazel mod graph
which is a transitive dep of grpc-java
shown as following, so neither of them is a direct dep
.
├───grpc-java@1.67.1
├───cel-spec@0.15.0
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.
I'd say that's desired behavior as it gives you the opportunity to explicitly add a replace
directive for the version you'd like, if you so chose.
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.
This check makes sense. I was just wondering whether this function outdated_direct_dep_printer
was designed for this purpose.
What type of PR is this?
Bug fix
What package or component does this PR mostly affect?
go_deps
What does this PR do? Why is it needed?
2a65ce8 made it so that Bazel modules would no longer override Go modules if their versions don't match exactly.
Also do not report version mismatches for overridden Bazel modules.
Which issues(s) does this PR fix?
Fixes #
Other notes for review