Golang protobuf definitions for the Proto plugin, for the Please build system.
First add the proto plugin and this plugin to your project:
# BUILD
plugin_repo(
name = "proto",
revision = "<Some git tag, commit, or other reference>",
)
plugin_repo(
name = "go-proto",
revision = "<Some git tag, commit, or other reference>",
)
Then add the go-proto to the list of language definitions:
[Plugin "proto"]
LanguageDef = ///go_proto//build_defs:go-proto
You'll then need to add the protobuf sdk, as well as the
gRPC sdk if you want to use grpc_library()
. You can copy the go_module()
rules
from third_party/go/BUILD
in this repo to get started.
You can then use proto_library()
or grpc_library()
to generate go code for your .proto files:
grpc_library(
name = "proto",
srcs = ["service.proto"],
visibility = ["//service/..."]
)
go_binary(
name = "service",
srcs = ["main.go"],
# This is the proto above
deps = ["//service/proto:proto"],
)
See the Proto plugin for more information on these rules.
This plugin can be configured via the plugins section as follows:
[Plugin "go-proto"]
SomeConfig = some-value