-
Notifications
You must be signed in to change notification settings - Fork 389
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
go_repository: support modules #400
Comments
This may work if you make the following change:
However, this is something that needs to be improved in
Some things which are important to note:
|
cc @Globegitter |
@jayconrod Just starting to put this on my radar again, so this is essentially a blocker for #394 right? So thinking highl-level about an implementation what we would need is:
These steps are how I imagine this in my head without actually having looked at the The next question then is should we per default download the go cli hermetically? Should there be an option to use a local go cli if the user wants? And then we of course need to make sure that things are only cached when Does this all make sense from your point of view? |
That makes sense. There are a few other considerations, too -- we should use a shared cache between Actually, I think I'm going to try to implement this today. This came up again in bazel-contrib/rules_go#1953, so we should really have this soon. |
go_repository has two new attributes: version and sum. If version is specified, go_repository will run in module mode (distinct from repository mode and http mode). version and sum must be specified together. In module mode, go_repository invokes fetch_repo with -version and -sum arguments. fetch_repo will run "go mod download" to retrieve the module. Fixes bazel-contrib#400
go_repository has two new attributes: version and sum. If version is specified, go_repository will run in module mode (distinct from repository mode and http mode). version and sum must be specified together. In module mode, go_repository invokes fetch_repo with -version and -sum arguments. fetch_repo will run "go mod download" to retrieve the module. This PR also moves build caching into a new internal repository, @bazel_gazelle_go_repository_cache, and it resolves labels to source files in go_repository_tools. This means that when gazelle or fetch_repo change, they should be automatically rebuilt. A module cache is also kept here. Fixes #400 Fixes #449
I know this has been closed for a while, but I just ran into the problem described in bazel-contrib/rules_go#1953. The workaround seems to fix the issue for me, but thought it was worth calling out here. I'm guessing the reason it wasn't covered by this fix is that the dependency I encountered this with has multiple modules in the same repo, as well as one at the root (which all the others are nested within). I'm pretty sure that practice is discouraged, but still, I want to depend on their code. |
When I try to build the example program hdfscat, I get an error that prevents a successful build.
When attempting to build the project, I get this error:
Reviewing the code, I found that the hdfs library uses semantic import versioning. In my
WORKSPACE
file, I do specify to use version two of the library:However, I can't find any way to tell bazel that it should expose the library as package
@com_github_colinmarc_hdfs//v2/internal/protocol/hadoop_hdfs
.Is there currently any way to solve this problem with bazel/gazelle?
The text was updated successfully, but these errors were encountered: