Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define syntax to fix [1]: protoc --go_out=./go config.proto [libprotobuf WARNING google/protobuf/compiler/parser.cc:492] No syntax specified for the proto file. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.) Drop 'optional' (with 'sed -i 's/\toptional /\t/' *.proto') to fix: protoc --go_out=./go config.proto config.proto:9:18: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default. Replace the User extensions with 'Any' [2,3] to fix: protoc --go_out=./go config.proto config.proto: Extensions in proto3 are only allowed for defining options. Drop required (with 'sed -i 's/\trequired /\t/' *.proto') to fix: protoc --go_out=./go runtime_config.proto runtime_config.proto: Required fields are not allowed in proto3. Drop DefaultState to fix: protoc --go_out=./go runtime_config.proto runtime_config.proto: Explicit default values are not allowed in proto3. There's still some trouble with the resulting Go: go run ./example.go go/config.pb.go:26:8: cannot find package "google/protobuf" in any of: /usr/lib/go/src/google/protobuf (from $GOROOT) /home/wking/.local/lib/go/src/google/protobuf (from $GOPATH) Makefile:31: recipe for target 'example' failed But I haven't been able to figure that out yet. [1]: https://developers.google.com/protocol-buffers/docs/proto3#simple [2]: https://developers.google.com/protocol-buffers/docs/proto3#any [3]: protocolbuffers/protobuf#828 Signed-off-by: W. Trevor King <wking@tremily.us>
- Loading branch information