From gazelle-generated BUILD files, I get the following error when I run 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'
Both BUILD files have:
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")
I have seen https://github.com/bazelbuild/rules_go/blob/master/go/providers.rst, but it was more confusing.
I also asked this on the Gophers Slack, but there is very little traffic there.
This error means that
//baz/quux/api:api_protois the wrong kind of target for thedepsattribute of thego_proto_libraryrule (it does not "provide" the right information).//baz/quux/api:api_protois probably aproto_librarytarget, and should be in theprotosattribute instead of thedepsattribute: https://github.com/bazelbuild/rules_go/blob/master/proto/core.rst#go_proto_library