Reputation: 49
Does optional supports in proto3 while working with Go? I tried with this:
protoc person.proto --go_out=. --experimental_allow_proto3_optional
but got this error
person.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-go hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.--go_out:
so proto3 (Go) does not support optional keyword?
Upvotes: 5
Views: 8034
Reputation: 44787
protoc
does support it, starting from version v3.15.0
. See the release notes:
Optional fields for proto3 are enabled by default, and no longer require the
--experimental_allow_proto3_optional
flag.
The protoc-gen-go
plugin does starting from v1.22.0
. Release notes:
This release adds support for the experimental proto3 optional semantics coming in the v3.12.0 release of the protobuf language, [...]
Make sure to upgrade your protoc-gen-go
to version v1.22.0
or above.
Upvotes: 7