0

从瞪羚生成的 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 上问过这个问题,但那里的流量很少。

4

1 回答 1

1

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

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

于 2020-10-08T15:04:54.307 回答