bazelbuild / bazel-gazelle

Gazelle is a Bazel build file generator for Bazel projects. It natively supports Go and protobuf, and it may be extended to support new languages and custom rule sets.
Apache License 2.0
1.18k stars 374 forks source link

Visibility error when building gopls #1630

Open eric-higgins-ai opened 1 year ago

eric-higgins-ai commented 1 year ago

What version of gazelle are you using?

v0.33.0

What version of rules_go are you using?

v0.41.0

What version of Bazel are you using?

6.0.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Ubuntu 22.04, amd64

What did you do?

Build gopls with bazel. That is, run bazel build @org_golang_x_tools_gopls//:gopls.

What did you expect to see?

Successful build

What did you see instead?

ERROR: /home/eric/.cache/bazel/_bazel_eric/f1d1ae8a5075539a72e45ef6b412b203/external/org_golang_x_tools_gopls/internal/lsp/analysis/fillstruct/BUILD.bazel:3:11: in go_library rule @org_golang_x_tools_gopls//internal/lsp/analysis/fillstruct:fillstruct: target '@org_golang_x_tools//internal/analysisinternal:analysisinternal' is not visible from target '@org_golang_x_tools_gopls//internal/lsp/analysis/fillstruct:fillstruct'. Check the visibility declaration of the former target if you think the dependency is legitimate

and several more similar errors. I tried passing both the gazelle:default_visibility and gazelle:go_visibility to the build_directives parameter in the go_repository rule for golang.org/x/tools but they didn't do anything.

Zemnmez commented 8 months ago

I had the same issue trying to get vscode to use a repository-local version of gopls