github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/docs/gogo.md (about) 1 --- 2 layout: default 3 title: gogo 4 permalink: examples/gogo 5 parent: Examples 6 --- 7 8 9 # gogo example 10 11 `bazel test //example/golden:gogo_test` 12 13 14 ## `BUILD.bazel` (after gazelle) 15 16 ~~~python 17 load("@rules_proto//proto:defs.bzl", "proto_library") 18 load("@build_stack_rules_proto//rules:proto_compile.bzl", "proto_compile") 19 20 # "proto_rule" instantiates the proto_compile rule 21 # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 22 23 # "proto_plugin" instantiates the builtin gogo plugin 24 # gazelle:proto_plugin gogo implementation gogo:protobuf:protoc-gen-gogo 25 26 # "proto_language" binds the rule(s) and plugin(s) together 27 # gazelle:proto_language gogo rule proto_compile 28 # gazelle:proto_language gogo plugin gogo 29 30 proto_library( 31 name = "example_proto", 32 srcs = ["example.proto"], 33 visibility = ["//visibility:public"], 34 ) 35 36 proto_compile( 37 name = "example_gogo_compile", 38 options = {"@build_stack_rules_proto//plugin/gogo/protobuf:protoc-gen-gogo": ["plugins=grpc"]}, 39 outputs = ["example.pb.go"], 40 plugins = ["@build_stack_rules_proto//plugin/gogo/protobuf:protoc-gen-gogo"], 41 proto = "example_proto", 42 ) 43 ~~~ 44 45 46 ## `BUILD.bazel` (before gazelle) 47 48 ~~~python 49 # "proto_rule" instantiates the proto_compile rule 50 # gazelle:proto_rule proto_compile implementation stackb:rules_proto:proto_compile 51 52 # "proto_plugin" instantiates the builtin gogo plugin 53 # gazelle:proto_plugin gogo implementation gogo:protobuf:protoc-gen-gogo 54 55 # "proto_language" binds the rule(s) and plugin(s) together 56 # gazelle:proto_language gogo rule proto_compile 57 # gazelle:proto_language gogo plugin gogo 58 ~~~ 59 60 61 ## `WORKSPACE` 62 63 ~~~python 64 ~~~ 65