Skip to content
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

Error while fetching external dependence #3823

Closed
Kruemelmann opened this issue Jan 9, 2024 · 7 comments
Closed

Error while fetching external dependence #3823

Kruemelmann opened this issue Jan 9, 2024 · 7 comments

Comments

@Kruemelmann
Copy link

What version of rules_go are you using?

0.44.0

also tryed 0.43.0 and 0.44.2

What version of gazelle are you using?

0.35.0

What version of Bazel are you using?

7.0.1rc1

also tryed 7.0.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

linux/amd64
darwin/amd64

What did you do?

I am trying to build a Golang workspace with bazel. However, I suspect that this is a problem with bzlmod.
I have uploaded a minimal example project to recreate the problem. The project can be found here

What did you expect to see?

I expected that programmes based on Go workspaces with external dependencies could be built and executed by bazel.

What did you see instead?

Error in path: Unable to load package for @@bazel_gazelle_go_repository_cache//:go.en
v: The repository '@@bazel_gazelle_go_repository_cache' could not be resolved: Reposi
tory '@@bazel_gazelle_go_repository_cache' is not defined
@fmeum
Copy link
Collaborator

fmeum commented Jan 9, 2024

Could you try emptying your WORKSPACE file? This setup isn't required with Bzlmod and mixing the two won't work.

@fmeum
Copy link
Collaborator

fmeum commented Jan 9, 2024

That said, we don't have support for go.work yet. You can currently only load deps from a single go.mod.

@Kruemelmann
Copy link
Author

Kruemelmann commented Jan 9, 2024

Many thanks for your fast reply. I tryed an empty WORKSPACE file aswell but gazelle is adding this lines automatically if i run

bazel run //:gazelle -- update-repos -from_file=go.work -to_macro=deps.bzl%go_dependencies

Thanks for mantioning that its not supported yet. I know that the following is not a official google example but i found an aspect build example
in which they show a similar setup and theirs seem to work.
The main difference is actually that they use the WORKSPACE file and i have gone with bzlmod.

Can you give a rough estimate of when the feature will be implemented or is Go Workspaces support more in the distant future?

Many thanks again

@fmeum
Copy link
Collaborator

fmeum commented Jan 9, 2024

Many thanks for your fast reply. I tryed an empty WORKSPACE file aswell but gazelle is adding this lines automatically if i run

I can't reproduce this. If I clear the contents of WORKSPACE.bazel, it remains empty after bazel run //:gazelle.

Can you give a rough estimate of when the feature will be implemented or is Go Workspaces support more in the distant future?

The main problem isn't so much to implement this, it's to make sense of what it means in the context of Bzlmod and how it should interact with other Bazel projects that are also Go workspaces. Could you file an issue over at https://github.com/bazelbuild/bazel-gazelle to track this? I don't think we have an issue for it yet.

@Kruemelmann
Copy link
Author

Kruemelmann commented Jan 9, 2024

Sorry for my mistake I just edited my comment with the correct command.


And of course I can create a corresponding issue at bazel-gazelle. I would simply adopt this description and refer to this issue for more information

@fmeum
Copy link
Collaborator

fmeum commented Jan 9, 2024

You don't need update-repos with Bzlmod, it also doesn't work. Please take a look at https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/bzlmod.md to learn how to do this with Bzlmod.

The Gazelle issue could be about go.work support specifically, not this example repo.

@Kruemelmann
Copy link
Author

Oh ok, thank you very much. I had actually completely missed that.

Thanks again for your patience with me :) and I'll close the issue here and open the issue in gazelle later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants