0

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.

JayEye
  • 457
  • 5
  • 15

1 Answers1

2

This error means that //baz/quux/api:api_proto is the wrong kind of target for the deps attribute of the go_proto_library rule (it does not "provide" the right information).

//baz/quux/api:api_proto is probably a proto_library target, and should be in the protos attribute instead of the deps attribute: https://github.com/bazelbuild/rules_go/blob/master/proto/core.rst#go_proto_library

Sjoerd Visscher
  • 11,840
  • 2
  • 47
  • 59