Skip to content

gopls (and other module tools): support for Bazel Build (or modules missing for a reason) #46070

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

Closed
oakad opened this issue May 9, 2021 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.

Comments

@oakad
Copy link

oakad commented May 9, 2021

A lot of projects these days rely on code generation of some sort, a very common example being GRPC/protobufs. To use those in Go project one has basically 2 choices:

  1. Some sort of custom code generation tooling executed out of band (a so - so solution)
  2. A more advanced unified build setup such as Bazel Build rules_go

Something like Bazel Build quickly becomes a necessity if a project is multi-lingual in nature. Again, a common example will be sharing of protobuf definitions between server and client code in the same repo, where server is implemented in Go and client is something else (C++ or whatever).

This creates a rather unfortunate problem: import statements referencing the generated modules will appear as pointing to nowhere to gopls and go mod. Bazel or whatever other tool may have already produced the proper go files for the generated modules, but there's no way to tell go helper tools something like "and also look outside of the main source tree for modules proto/x and proto/y".

This issue may seem fanciful, but considering how quickly and deeply GRPC, to name one example, proliferates in various Go projects, I think it's something worth looking at.

@oakad oakad changed the title bazel build gopls (and other module tools): support for Bazel Build (or modules missing for a reason) May 9, 2021
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label May 9, 2021
@seankhliao
Copy link
Member

Duplicate of #37205

@seankhliao seankhliao marked this as a duplicate of #37205 May 9, 2021
@golang golang locked and limited conversation to collaborators May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Projects
None yet
Development

No branches or pull requests

3 participants