bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.37k stars 651 forks source link

Support Protocol Buffers Editions in Go proto code generator #3972

Closed deepakm37 closed 2 months ago

deepakm37 commented 3 months ago

What version of rules_go are you using?

Rules Go v0.48.1

What version of gazelle are you using?

Gazelle v0.37.0

What version of Bazel are you using?

Bazel v7.2.0

Does this issue reproduce with the latest releases of all the above?

Yes, the versions listed above are the latest releases at this time.

What operating system and processor architecture are you using?

Ubuntu 20.04, x86_64

Any other potentially useful information about your toolchain?

Nothing specially configured.

What did you do?

I'm trying to use the new Protocol Buffers Editions. Specifically, I switched from using syntax = "proto3" to edition = "2023" in the proto files.

What did you expect to see?

A successful generation of Go proto package.

What did you see instead?

After the switch to edition, building a go_proto_library target fails with an error such as:

xyz.proto: is an editions file, but code generator protoc-gen-go hasn't been updated to support editions yet.  Please ask the owner of this code generator to add support or switch back to proto2/proto3.

See https://protobuf.dev/editions/overview/ for more information.--go_out: 

I understand that the code generator protoc-gen-go doesn't yet support editions, but it will be great to add the support as Protocol Buffers is switching over to editions for all future releases.

deepakm37 commented 2 months ago

Apparently I was using an older version of protoc-gen-go, and updating it solved the problem.