xx
.md

go_protobuf

go_protobuf installs google.golang.org/protobuf/cmd/protoc-gen-go with the selected managed Go SDK and returns a typed generator for protobuf_generate.

Arguments

ArgumentRequiredDescription
versionYesExact protoc-gen-go semantic version without a leading v, such as "1.36.6".
depsNoDependencies activated before go install, in list order. Defaults to [].

Selecting this generator installs the pinned protoc-gen-go automatically before protoc runs. Use deps to configure the installation; no separate installation dependency is needed.

Example

load("@[email protected]", "go_protobuf")
load("@[email protected]", "protobuf_generate")

protobuf_generate(
    sources=["proto/service.proto"],
    generator=go_protobuf("1.36.6"),
    output="generated/go",
    proto_paths=["proto"],
    options=["paths=source_relative"],
)