-
-
Notifications
You must be signed in to change notification settings - Fork 678
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
BzlMod external Dependency instructions are not working #4104
Comments
Thanks for the very detailed description of the challenges you faced. We don't currently support absolute paths in You might want to look into |
Regarding protobuf, you are running into an issue ultimately fixed by this commit 2f062f8 a few hours ago. You could also try to run We should definitely improve the docs, so if you identify anything that's missing, it would be highly appreciated if you could send a PR. |
I'm working on consolidating into a monorepo, but for curiosity: the issues with trying to get "local" remote repos to work also manifest in the same way if I used relative paths (e.g. "../otherworkspace") in the go.mod file. Would that fall under the same "not supported" issue? |
Relative paths should work since bazel-contrib/bazel-gazelle#1776. But I haven't tried this myself yet, so if you find something that needs to be fixed, please let me know. |
I tried to revisit this today since I have plans for a little project that I want to keep out of my main "monolith" repo but still be ablw to depend on some of my common library code from it. I went back to my demo from golang_bzlmod_demo to look at the dependency. I didn't make changes, but it's been long enough that bazelisk downloaded bazel version 7.4.1. I tried removing the references to the greeting package from
Ok, that makes sense, it doesn't know (anymore/yet) to look locally. So I added To the
So it complained at first and said the the imports for A subsequent run of At this point, the But trying to
I don't understand the error message or what "incorrect function" means here. It seems like there is some error in trying to actually read the other repo's So it looks like things are still stuck. The absolute vs. relative path doesn't seem to make a difference. I can change the replace path from the absolute one to |
What version of rules_go are you using?
0.50.1
What version of gazelle are you using?
0.38.0
What version of Bazel are you using?
7.3.1
Does this issue reproduce with the latest releases of all the above?
Yes.
What operating system and processor architecture are you using?
Windows 10 x64
Any other potentially useful information about your toolchain?
No
What did you do?
I tried to use the rules_go bzlmod docs to set up a very simple dependency between local modules and then later with an external dependency (
com_github_golang_protobuf
) just to test that I knew what I was doing, but even those minimal examples failed.I created a repo for my minimal examples at https://github.com/bdleitner/golang_bzlmod_demo
What did you expect to see?
bazel run @rules_go/go -- mod tidy -v
should update thego.mod
file and not show errors, and should update theuse_repo
section ofMODULE.bazel
as well.Once the
use_repo
section is manually updated,bazel build
should succeed.What did you see instead?
bazel run @rules_go/go -- mod tidy -v
reports errors some errors and does not update thego.mod
file or theuse_repo
section ofMODULE.bazel
.bazel mod tidy
removes entries fromuse_repo
that I need.Once the
use_repo
section is manually updated,bazel build
should succeed - this seems to work for thegithub.com/golang/protobuf
dependency if I fix everything manually, but the tooling at best doesn't help and at worst tries to remove needed entries. Nothing seems to work for "local" external dependencies.The text was updated successfully, but these errors were encountered: