Skip to content

Upgrading to bazel modules #5389

@itmecho

Description

@itmecho

🐛 Bug Report

I'm trying to upgrade our monorepo to bazel modules but I'm getting an issue where grpc-gateway doesn't seem to be able to resolve the @googleapis module. This is the error I'm getting:

ERROR: no such package '@@[unknown repo 'googleapis' requested from @@gazelle++go_deps+com_github_grpc_ecosystem_grpc_gateway_v2]//google/api': The repository '@@[unknown repo 'googleapis' requested from @@gazelle++go_deps+com_github_grpc_ecosystem_grpc_gateway_v2]' could not be resolved: No repository visible as '@googleapis' from repository '@@gazelle++go_deps+com_github_grpc_ecosystem_grpc_gateway_v2'

I have tried running the following commands and they both work so I'm pretty sure I've configured the root module correctly

bazel build @googleapis//google/api:annotations_proto
bazel build @googleapis//google/api:annotations_go_proto

To Reproduce

I have created a minimal repo that has the same issue. The README contains the output from some relevant commands.

https://github.com/itmecho/bzlmodgotest

Expected behavior

grpc-gateway should be able to resolve @googleapis

Actual Behavior

ERROR: no such package '@@[unknown repo 'googleapis' requested from @@gazelle++go_deps+com_github_grpc_ecosystem_grpc_gateway_v2]//google/api': The repository '@@[unknown repo 'googleapis' requested from @@gazelle++go_deps+com_github_grpc_ecosystem_grpc_gateway_v2]' could not be resolved: No repository visible as '@googleapis' from repository '@@gazelle++go_deps+com_github_grpc_ecosystem_grpc_gateway_v2'

Your Environment

macOS 15.3.2
go 1.24
bazel 8.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions