Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for optional fields #1595

Closed
wim07101993 opened this issue Mar 5, 2024 · 2 comments
Closed

Support for optional fields #1595

wim07101993 opened this issue Mar 5, 2024 · 2 comments

Comments

@wim07101993
Copy link

wim07101993 commented Mar 5, 2024

When declaring a field as optional the protoc-gen-go compiler exits with the error: protos/test.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.

Is this still experimental? It was added in v1.22.0 almost 4 years ago.

command: protoc --go_out "generated" protos/test.proto

proto file:

syntax = "proto3";

package option_test;

option go_package = "grpc_test";

message OptionMessage {
  optional int32 value = 1;
}
$ protoc --version
libprotoc 3.12.4
$ protoc-gen-go --version
protoc-gen-go v1.28.1
@neild
Copy link
Contributor

neild commented Mar 5, 2024

That error message is printed by protoc, not the Go code generator.

I believe the most recent version of protoc is 25.3:
https://github.com/protocolbuffers/protobuf/releases

@wim07101993
Copy link
Author

Indeed, the version I had came from the Ubuntu package manager but hasn't been updated since 2020... The latest releases from github seem to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants