You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ISSUE <<<<<<<
When using the Connect plugin in a Bazel rule, the protobuf and connect .go files are generated in a single directory, which has two packages in a single directory and won't bulid. I'd appreciate your suggestions for resolving this issue. Otherwise, it seems that protobuf and connect generation in Bazel is working.
// HAVE
'bazel-bin/proto/helloworld/v1/helloworld.go'
'bazel-bin/proto/helloworld/v1/helloworld.connect.go'
// NEED
'bazel-bin/proto/helloworld/v1/helloworld.go'
'bazel-bin/proto/helloworld/v1/helloworldv1connect/helloworld.connect.go'
I am able to properly generate the protobuf and connect files using protoc and 'buf generate':
protoc -I proto --go_out='internal/gen/' --go_opt=paths=source_relative --connect-go_out='internal/gen/' --connect-go_opt=paths=source_relative $(find proto -name '*.proto')
// From the directory where buf.yaml and buf.gen.yaml exist.
buf generate
I've configured BUILD.bazel where the helloworld.proto file exists with a rule defining Connect's plug-in compiler.
go_proto_compiler(
name = "connect_go_proto_compiler",
options = [
"lang=go",
],
plugin = "@com_connectrpc_connect//cmd/protoc-gen-connect-go:protoc-gen-connect-go",
suffix = ".connect.go",
valid_archive = False,
visibility = ["//visibility:public"],
deps = ["@com_connectrpc_connect//:go_default_library"],
)
// and a rule to generate the protobuf and connect .go files:
go_proto_library(
name = "helloworldv1_go_proto",
compilers = [
"//proto/helloworld/v1:connect_go_proto_compiler",
"@rules_go//proto:go_proto",
],
importpath = "github.com/abitofhelp/bzlmod/proto/helloworld/v1",
proto = ":helloworldv1_proto",
visibility = ["//:__subpackages__"],
)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Please see solution at https://github.com/abitofhelp/connect-go-example.git
and issue/feature request at rules_go: bazel-contrib/rules_go#3951
Hello,
SOURCE: https://github.com/abitofhelp/bzlmod
// HAVE
'bazel-bin/proto/helloworld/v1/helloworld.go'
'bazel-bin/proto/helloworld/v1/helloworld.connect.go'
// NEED
'bazel-bin/proto/helloworld/v1/helloworld.go'
'bazel-bin/proto/helloworld/v1/helloworldv1connect/helloworld.connect.go'
I am able to properly generate the protobuf and connect files using protoc and 'buf generate':
I've configured BUILD.bazel where the helloworld.proto file exists with a rule defining Connect's plug-in compiler.
Beta Was this translation helpful? Give feedback.
All reactions