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

andybons opened this issue Jan 27, 2021 · 1 comment
gopls NeedsInvestigation Tools


Copy link

@andybons andybons commented Jan 27, 2021

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 gopls labels Jan 27, 2021
@gopherbot gopherbot added the Tools label Jan 27, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jan 27, 2021
@stamblerre stamblerre removed this from the Unreleased milestone Jan 27, 2021
@stamblerre stamblerre added this to the gopls/unplanned milestone Jan 27, 2021
Copy link

@adam-azarchs adam-azarchs commented Aug 12, 2021

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
gopls NeedsInvestigation Tools
None yet

No branches or pull requests

4 participants