Commit 893a52c
Improve consistency by prefering bazel_dep over Go
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 #20601 parent e59910c commit 893a52c
File tree
5 files changed
+8
-9
lines changed- internal/bzlmod
- tests/bcr
- go_mod
- go_work/pkg
5 files changed
+8
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
567 | | - | |
568 | | - | |
| 566 | + | |
| 567 | + | |
569 | 568 | | |
570 | 569 | | |
571 | 570 | | |
| |||
617 | 616 | | |
618 | 617 | | |
619 | 618 | | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | 619 | | |
625 | 620 | | |
626 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
0 commit comments