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

Can't resolve root module from external module #1862

Closed
tokongs opened this issue Aug 13, 2024 · 2 comments · Fixed by #1863
Closed

Can't resolve root module from external module #1862

tokongs opened this issue Aug 13, 2024 · 2 comments · Fixed by #1863

Comments

@tokongs
Copy link

tokongs commented Aug 13, 2024

What version of gazelle are you using?

v0.38.0

What version of rules_go are you using?

v0.47.1

What version of Bazel are you using?

7.1.1

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

Yes

What operating system and processor architecture are you using?

Linux x86

What did you do?

Add a gazelle:resolve to resolve a name to a target in the local root module like so:

go_deps.gazelle_override(
  path = "cel.dev/expr",
  build_file_generation = "on",
  directives = ["gazelle:resolve proto google/rpc/status.proto @@//:googleapis_rpc_status"]
)

What did you expect to see?

I expected this to successfully resolve, as @@//... should be visible to external modules.

What did you see instead?

It did not resolve. Inspecting the generated BUILD.bazel file shows that the double @@ was replaced with a single @.

Generated BUILD.bazel:

proto_library(
    name = "expr_proto",
    srcs = [...],
    deps = [
        ...,
        "@//:googleapis_rpc_status"
    ],
)
@fmeum
Copy link
Member

fmeum commented Aug 13, 2024

@tokongs Could you check whether this is fixed by #1863?

@tokongs
Copy link
Author

tokongs commented Aug 13, 2024

@fmeum seems to fix the issue! I do get some other errors when overriding gazelle to your commits, but I assume those are unrelated.

ERROR: /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/rules_go~/go/platform/BUILD.bazel: no such target '@@rules_go~//go/platform:o
sx': target 'osx' not declared in package 'go/platform' defined by /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/rules_go~/go/plat
form/BUILD.bazel
ERROR: /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/rules_go~/go/platform/BUILD.bazel: no such target '@@rules_go~//go/platform:q
nx': target 'qnx' not declared in package 'go/platform' defined by /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/rules_go~/go/plat
form/BUILD.bazel
ERROR: /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/gazelle~~go_deps~com_github_prometheus_client_golang/prometheus/BUILD.bazel:3
:11: errors encountered resolving select() keys for @@gazelle~~go_deps~com_github_prometheus_client_golang//prometheus:prometheus
ERROR: /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/gazelle~~go_deps~com_github_mattn_go_colorable/BUILD.bazel:3:11: errors encou
ntered resolving select() keys for @@gazelle~~go_deps~com_github_mattn_go_colorable//:go-colorable
ERROR: /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/gazelle~~go_deps~org_golang_google_grpc/internal/syscall/BUILD.bazel:3:11: er
rors encountered resolving select() keys for @@gazelle~~go_deps~org_golang_google_grpc//internal/syscall:syscall
ERROR: /home/tokongs/.cache/bazel/_bazel_tokongs/51d0d670cf09bb319bf1151bdc73a969/external/gazelle~~go_deps~com_github_outcaste_io_ristretto/z/BUILD.bazel:3:11: errors 
encountered resolving select() keys for @@gazelle~~go_deps~com_github_outcaste_io_ristretto//z:z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants