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

x/tools/gopls: detect unsupported build systems and improve error messages/performance #43937

Open
andybons opened this issue Jan 27, 2021 · 1 comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@andybons
Copy link
Member

I recently ran into issues caused by bazelbuild/rules_go#512, but the error message displayed by gopls seemed unrelated. Within my editor (VS Code) I just see Error loading workspace: go [-e -json -compiled=true -test=true -export=false -deps=false -- builtin <redacted>: exit status 2: warning: ignoring symlink ....

I spoke with @stamblerre to diagnose the issue and it came down to the fact that gopls doesn’t know about generated files due to the Bazel Go rules issue linked above. It’s even stated in the README:

gopls currently only supports the go command, so if you are using a different build system, gopls will not work well. Bazel support is currently blocked on bazelbuild/rules_go#512.

I was curious of whether it would be possible to detect a WORKSPACE file at the directory root and display a more helpful error or warning. One could even disable certain features or bail early from long-running commands that repeatedly fail.

ccing @jayconrod for any insight into detecting an unsupported build system like Bazel.

Thanks, all!

@andybons andybons added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. labels Jan 27, 2021
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jan 27, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jan 27, 2021
@adam-azarchs
Copy link
Contributor

Personally I work on a project that uses bazel as the primary build system, but gopls mostly works fine, so long as you drop in a go.mod to help it along. I say mostly because it starts traversing the bazel-* symlinks, which can be more than a slight problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants