protocolbuffers / protocolbuffers.github.io

Other
38 stars 107 forks source link

Fix protobuf examples at editions/overview.md #150

Closed SpringMT closed 2 months ago

SpringMT commented 4 months ago

Lexical Scoping protobuf examples is invalid.

$ cat person.proto
edition = "2023";

option features.enum_type = CLOSED;

message Person {
  string name = 1;
  int32 id = 2 [features.presence = IMPLICIT];

  enum Pay_Type {
    PAY_TYPE_UNSPECIFIED = 1,
    PAY_TYPE_SALARY = 2,
    PAY_TYPE_HOURLY = 3
  }

  enum Employment {
    option features.enum_type = OPEN;
    EMPLOYMENT_UNSPECIFIED = 0,
    EMPLOYMENT_FULLTIME = 1,
    EMPLOYMENT_PARTTIME = 2,
  }
  Employment employment = 4;
}

$ protoc --go_out=./my_proto --go_opt=paths=source_relative person.proto
person.proto:10:29: Expected ";".
person.proto:17:31: Expected ";".

In this PR, fix using valid protobuf.

Logofile commented 3 months ago

Thanks for sending this PR to fix the syntax problems. I'll work on getting this incorporated.

Logofile commented 2 months ago

This fix was incorporated in this PR that bundled various updates. Thanks for sending the update!