You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bazel_dep(name = "flatbuffers", version = "24.3.25", repo_name = "com_github_google_flatbuffers")
go.mod (includes direct dep)
github.com/google/flatbuffers v2.0.8+incompatible
bazel mod tidy:
ported incorrect imports of repositories via use_repo():
Not imported, but reported as direct dependencies by the extension (may cause the build to fail):
com_github_google_flatbuffers
Fix the use_repo calls by running 'bazel mod tidy'.
INFO: Updated use_repo calls for @bazel_gazelle//:extensions.bzl%go_deps
Build failure caused:
tfrench@go(tfrench.devpod-us-va) ~/go-code
% bazel mod --enable_bzlmod tidy
INFO: Invocation ID: ff5667e5-9cef-425c-b978-77434bfebe7d
ERROR: Traceback (most recent call last):
File "/home/user/go-code/MODULE.bazel", line 209, column 8, in <toplevel>
include("//third_party:go_deps.MODULE.bazel")
File "<builtin>", in include
File "/home/user/go-code/third_party/go_deps.MODULE.bazel", line 17, column 9, in <toplevel>
use_repo(
Error in use_repo: The repo name 'com_github_google_flatbuffers' is already being used by a bazel_dep at /home/user/go-code/MODULE.bazel:40:10
ERROR: error executing MODULE.bazel file for <root>. Type 'bazel help mod' for syntax and help.
The text was updated successfully, but these errors were encountered:
In Bazel 7.4.0 and 8, you will be able to have go_deps reuse the bazel_dep via override_repo. I will add a test case to verify that bazel mod tidy behaves correctly in that case.
I wonder if for now we can just look at all the repo_name of the bazel_dep in the root MODULE.bazel, and then skip adding these to direct dependencies?
The Gazelle extension can't do this as it doesn't have access to MODULE files.
Having looked into this more, I think that it's actually a feature (but not with a good error message): You have the same dep show up under two different names in your dep tree, which can result in linker errors. Instead, when Bazel 7.4.0 lands, you should use override_repo to replace the extension repo with the Bazel dep.
To reproduce:
MODULE.bazel
go.mod (includes direct dep)
bazel mod tidy
:Build failure caused:
The text was updated successfully, but these errors were encountered: