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
I am trying to use the go_deps extension to import dependencies from go.mod files and am running into a case that works with Go's dependency resolution but does not work so well with Gazelle/Bazel.
[bstoll@bstoll-ct:parent]$ go run github.com/bstoll/import-visibility-parent/cmd
Hello from main v2
Hello from child v2
Hello from parent v2
However, with Bazel this fails:
[bstoll@bstoll-ct:parent]$ bazel run //cmd:cmd
ERROR: no such package '@@[unknown repo 'com_github_bstoll_import_visibility_parent' requested from @@gazelle++go_deps+com_github_bstoll_import_visibility_child]//': The repository '@@[unknown repo 'com_github_bstoll_import_visibility_parent' requested from @@gazelle++go_deps+com_github_bstoll_import_visibility_child]' could not be resolved: No repository visible as '@com_github_bstoll_import_visibility_parent' from repository '@@gazelle++go_deps+com_github_bstoll_import_visibility_child'
ERROR: /usr/local/google/home/bstoll/.cache/bazel/_bazel_bstoll/2e7b003f152a6b9486f33cb666da68af/external/gazelle++go_deps+com_github_bstoll_import_visibility_child/BUILD.bazel:6:11: no such package '@@[unknown repo 'com_github_bstoll_import_visibility_parent' requested from @@gazelle++go_deps+com_github_bstoll_import_visibility_child]//': The repository '@@[unknown repo 'com_github_bstoll_import_visibility_parent' requested from @@gazelle++go_deps+com_github_bstoll_import_visibility_child]' could not be resolved: No repository visible as '@com_github_bstoll_import_visibility_parent' from repository '@@gazelle++go_deps+com_github_bstoll_import_visibility_child' and referenced by '@@gazelle++go_deps+com_github_bstoll_import_visibility_child//:import-visibility-child'
ERROR: Analysis of target '//cmd:cmd' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.783s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target
The issue seems to be that the parent package is not made available as com_github_bstoll_import_visibility_parent to go_deps. There are some knobs I found that force this into working by adding this to MODULE.bazel:
I am not sure if this is an ideal solution to this problem. While unwinding this is probably ideal, can the go_deps extension make the parent repository available for children to import from?
The text was updated successfully, but these errors were encountered:
I am trying to use the go_deps extension to import dependencies from go.mod files and am running into a case that works with Go's dependency resolution but does not work so well with Gazelle/Bazel.
I have an example repository at https://github.com/bstoll/import-visibility-parent and https://github.com/bstoll/import-visibility-child. The parent depends on the child, which depends on the parent. In this scenario, Go's module system allows this to work:
However, with Bazel this fails:
The issue seems to be that the parent package is not made available as com_github_bstoll_import_visibility_parent to go_deps. There are some knobs I found that force this into working by adding this to MODULE.bazel:
I am not sure if this is an ideal solution to this problem. While unwinding this is probably ideal, can the go_deps extension make the parent repository available for children to import from?
The text was updated successfully, but these errors were encountered: