Skip to content

Commit ea388e2

Browse files
committed
internal/testprotos/lazy: convert .proto files to editions
This will be useful in a follow-up change to reproduce a bug. Change-Id: Ide5d174af24c054be75709b4ed77eb9956b411ec Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/727140 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Lasse Folger <lassefolger@google.com>
1 parent 46f785e commit ea388e2

6 files changed

Lines changed: 43 additions & 60 deletions

internal/testprotos/lazy/lazy_extension_normalized_wire_test.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/testprotos/lazy/lazy_extension_normalized_wire_test.proto

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
syntax = "proto2";
5+
edition = "2023";
66

77
package lazy_extension_normalized_wire_test;
88

99
option go_package = "google.golang.org/protobuf/internal/testprotos/lazy";
1010

1111
message Sub {
1212
extensions 2 [verification = UNVERIFIED];
13-
optional uint32 c = 3;
14-
optional Sub grandchild = 4;
13+
uint32 c = 3;
14+
Sub grandchild = 4;
1515
}
1616

1717
message Top {
18-
optional uint32 a = 1;
19-
optional Sub child = 2;
18+
uint32 a = 1;
19+
Sub child = 2;
2020
}
2121

2222
message Ext {
2323
extend Sub {
24-
optional Ext b = 2;
24+
Ext b = 2;
2525
}
2626

27-
optional bool some_flag = 1;
27+
bool some_flag = 1;
2828
}

internal/testprotos/lazy/lazy_extension_test.pb.go

Lines changed: 6 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/testprotos/lazy/lazy_extension_test.proto

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
syntax = "proto2";
5+
edition = "2023";
66

77
package lazy_extension_test;
88

@@ -12,15 +12,15 @@ option go_package = "google.golang.org/protobuf/internal/testprotos/lazy";
1212

1313
// This message contains a message set.
1414
message Holder {
15-
optional goproto.proto.messageset.MessageSet data = 1;
15+
goproto.proto.messageset.MessageSet data = 1;
1616
}
1717

1818
// This message may be inserted into a message set.
1919
message Rabbit {
2020
extend goproto.proto.messageset.MessageSet {
21-
optional Rabbit message_set_extension = 345570595;
21+
Rabbit message_set_extension = 345570595;
2222
}
23-
optional string name = 1;
23+
string name = 1 [features.utf8_validation = NONE];
2424
}
2525

2626
enum FlyingFoxSpecies {
@@ -44,37 +44,42 @@ enum PipistrelleSpecies {
4444
}
4545

4646
message FlyingFox {
47-
optional FlyingFoxSpecies species = 1;
47+
FlyingFoxSpecies species = 1;
4848
}
4949

5050
message Tree {
51-
optional bool eucalyptus = 1;
51+
bool eucalyptus = 1;
5252
extensions 10000 to max;
5353
}
5454

5555
extend Tree {
56-
optional FlyingFox bat = 345570595;
56+
FlyingFox bat = 345570595;
5757
}
5858

5959
extend Tree {
60-
optional FlyingFox bat_pup = 345570596;
60+
FlyingFox bat_pup = 345570596;
61+
}
62+
63+
message Pipistrelle {
64+
PipistrelleSpecies species = 1;
65+
}
66+
67+
message Pipistrelles {
68+
PipistrelleSpecies species = 1;
6169
}
6270

6371
extend Tree {
6472
repeated FlyingFox bat_posse = 345570597;
65-
optional bytes binary_bat = 345570598;
66-
optional uint32 integer_bat = 345570599;
67-
optional group Pipistrelle = 345570600 {
68-
optional PipistrelleSpecies species = 1;
69-
}
70-
repeated group Pipistrelles = 345570601 {
71-
optional PipistrelleSpecies species = 1;
72-
}
73+
bytes binary_bat = 345570598;
74+
uint32 integer_bat = 345570599;
75+
Pipistrelle pipistrelle = 345570600 [features.message_encoding = DELIMITED];
76+
repeated Pipistrelles pipistrelles = 345570601
77+
[features.message_encoding = DELIMITED];
7378
}
7479

7580
// And the ugly version that is not encouraged
7681
message BatNest {
7782
extend Tree {
78-
optional FlyingFox bat = 345570602;
83+
FlyingFox bat = 345570602;
7984
}
8085
}

internal/testprotos/lazy/lazy_normalized_wire_test.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/testprotos/lazy/lazy_normalized_wire_test.proto

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
syntax = "proto2";
5+
edition = "2023";
66

77
package lazy_normalized_wire_test;
88

99
option go_package = "google.golang.org/protobuf/internal/testprotos/lazy";
1010

1111
message FSub {
12-
optional uint32 b = 2;
13-
optional uint32 c = 3;
14-
optional FSub grandchild = 4 [lazy = true];
12+
uint32 b = 2;
13+
uint32 c = 3;
14+
FSub grandchild = 4 [lazy = true];
1515
}
1616

1717
message FTop {
18-
optional uint32 a = 1;
19-
optional FSub child = 2;
18+
uint32 a = 1;
19+
FSub child = 2;
2020
}

0 commit comments

Comments
 (0)