Improve consistency by prefering bazel_dep over Go (#2065)
Letting the bazel_dep and Go dependency participate equally in the
version resolution is creating various inconsistencies. This can lead to
to a root module having to either use `inject_repo` or `use_repo` and
`override_repo`.
Resolve this by consistently preferring the `bazel_dep` over the Go
dependency. Keep the existing code that warns (or can fail) if the
dependencies are at different versions.
Example MODULE.bazel:
```
module(
name = "bazel_dep_should_win",
)
bazel_dep(name = "rules_go", version = "0.53.0")
bazel_dep(name = "gazelle", version = "0.42.0")
bazel_dep(name = "circl", version = "1.3.8")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
```
And the go.mod referring to a newer version.
Fixes #2060
<!-- Thanks for sending a PR! Before submitting:
1. If this is your first PR, please read CONTRIBUTING.md and sign the
CLA
first. We cannot review code without a signed CLA.
2. Please file an issue *first*. All features and most bug fixes should
have
an associated issue with a design discussed and decided upon. Small bug
fixes and documentation improvements don't need issues.
3. New features and bug fixes must have tests. Documentation may need to
be updated. If you're unsure what to update, send the PR, and we'll
discuss
in review.
-->
**What type of PR is this?**
> Uncomment one line below and remove others.
>
> Bug fix
> Feature
> Documentation
> Other
**What package or component does this PR mostly affect?**
> For example:
>
> language/go
> cmd/gazelle
> go_repository
> all
**What does this PR do? Why is it needed?**
**Which issues(s) does this PR fix?**
Fixes #
**Other notes for review**
5 files changed