Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/gopls: Bazel Build linked directories in a workspace root break gopls in a curious way #41511
Clearly related to #39841 and it does feels like a regression.
I believe, it was not an issue in earlier versions of gopls, but it is definitely very pronounced with 0.5.0
Bazel Build, as part of the build process (not related to Go proper), creates several helper directories and links them into the workspace. In particular, it will create a link called "bazel-" pointing to a directory (so called "execroot") full of soft links to all the files in the workspace.
Under some circumstances, it is desirable to build Bazel artifacts in the same directory as some Go module. However, it seems, that presence of those Bazel "link farms" confuses gopls substantially, causes it to report various "phantom" code issues and crash every now and then.
In the logs, the indication of the coming problem can be observed:
It is not clear, why gopls suddenly decides to prefer the link farm as compared to the actual file.
No crash dump is present in the logs, apart from