gazelle+protobuf 问题:没有强制提供者:'GoLibrary'

gazelle+protobuf problem: does not have mandatory providers: 'GoLibrary'

从 gazelle 生成的 BUILD 文件中,当我 运行 bazel build //foo/bar/protos/...:

时出现以下错误

ERROR: .../foo/bar/protos/BUILD.bazel:15:17: in deps attribute of go_proto_library rule //foo/bar/protos:protos_go_proto: '//baz/quux/api:api_proto' does not have mandatory providers: 'GoLibrary'

两个 BUILD 文件都有:

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

我看过https://github.com/bazelbuild/rules_go/blob/master/go/providers.rst,但比较混乱

我也在 Gophers Slack 上问过这个问题,但是那里的流量很少。

这个错误意味着 //baz/quux/api:api_protogo_proto_library 规则的 deps 属性的错误类型的目标(它没有“提供”正确的信息)。

//baz/quux/api:api_proto 可能是一个 proto_library 目标,应该在 protos 属性中而不是 deps 属性中: https://github.com/bazelbuild/rules_go/blob/master/proto/core.rst#go_proto_library