Skip to content

Commit

Permalink
all: format all .proto files
Browse files Browse the repository at this point in the history
Change-Id: Ied684945de38ab1895c3ce8afaa1d84cda1e24f9
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/566037
Auto-Submit: Lasse Folger <[email protected]>
Reviewed-by: Michael Stapelberg <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
lfolger authored and gopherbot committed Feb 23, 2024
1 parent f2cb7f1 commit 2caa6b0
Show file tree
Hide file tree
Showing 71 changed files with 3,304 additions and 3,208 deletions.
24 changes: 10 additions & 14 deletions cmd/protoc-gen-go/testdata/comments/comments.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comme
// COMMENT: Enum1.Leading
enum Enum1 {
// COMMENT: FOO.Leading
FOO = 0; // COMMENT: FOO.InlineTrailing
FOO = 0; // COMMENT: FOO.InlineTrailing
// COMMENT: BAR.Leading
BAR = 1;
// COMMENT: BAR.Trailing1
Expand All @@ -24,38 +24,34 @@ enum Enum1 {
// COMMENT: Message1.Leading
message Message1 {
// COMMENT: Message1A.Leading
message Message1A {
} // COMMENT: Message1A.Trailing
message Message1A {} // COMMENT: Message1A.Trailing

// COMMENT: Message1B
message Message1B {
}
message Message1B {}

// COMMENT: Field1A.Leading
optional string Field1A = 1; // COMMENT: Field1A.Trailing
optional string Field1A = 1; // COMMENT: Field1A.Trailing

// COMMENT: Oneof1A.Leading
oneof Oneof1a {
// COMMENT: Oneof1AField1.Leading
string Oneof1AField1 = 2; // COMMENT: Oneof1AField1.Trailing
} // COMMENT: Oneof1A.Trailing
string Oneof1AField1 = 2; // COMMENT: Oneof1AField1.Trailing
} // COMMENT: Oneof1A.Trailing

extensions 100 to max;
} // COMMENT: Message1.Trailing
} // COMMENT: Message1.Trailing

// COMMENT: Extend
extend Message1 {
// COMMENT: Extension.Leading
optional Message1 extension = 100; // COMMENT: Extension.Trailing
optional Message1 extension = 100; // COMMENT: Extension.Trailing
}

// COMMENT: Message2
message Message2 {
// COMMENT: Message2A
message Message2A {
}
message Message2A {}

// COMMENT: Message2B
message Message2B {
}
message Message2B {}
}
6 changes: 4 additions & 2 deletions cmd/protoc-gen-go/testdata/comments/deprecated.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comme

message DeprecatedMessage {
option deprecated = true;
string deprecated_field = 1 [deprecated=true];

string deprecated_field = 1 [deprecated = true];
}

enum DeprecatedEnum {
option deprecated = true;
DEPRECATED = 0 [deprecated=true];

DEPRECATED = 0 [deprecated = true];
}
1 change: 1 addition & 0 deletions cmd/protoc-gen-go/testdata/extensions/base/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ message BaseMessage {

message MessageSetWireFormatMessage {
option message_set_wire_format = true;

extensions 100 to max;
}
68 changes: 34 additions & 34 deletions cmd/protoc-gen-go/testdata/extensions/ext/ext.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

syntax = "proto2";

package goproto.protoc.extension.ext;

import "cmd/protoc-gen-go/testdata/extensions/base/base.proto";
import "cmd/protoc-gen-go/testdata/extensions/extra/extra.proto";

package goproto.protoc.extension.ext;

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/ext";

message Message {
Expand All @@ -23,23 +23,23 @@ enum Enum {

// Extend with various types.
extend goproto.protoc.extension.base.BaseMessage {
optional bool extension_bool = 101;
optional Enum extension_enum = 102;
optional int32 extension_int32 = 103;
optional sint32 extension_sint32 = 104;
optional uint32 extension_uint32 = 105;
optional int64 extension_int64 = 106;
optional sint64 extension_sint64 = 107;
optional uint64 extension_uint64 = 108;
optional sfixed32 extension_sfixed32 = 109;
optional fixed32 extension_fixed32 = 110;
optional float extension_float = 111;
optional sfixed64 extension_sfixed64 = 112;
optional fixed64 extension_fixed64 = 113;
optional double extension_double = 114;
optional string extension_string = 115;
optional bytes extension_bytes = 116;
optional Message extension_Message = 117;
optional bool extension_bool = 101;
optional Enum extension_enum = 102;
optional int32 extension_int32 = 103;
optional sint32 extension_sint32 = 104;
optional uint32 extension_uint32 = 105;
optional int64 extension_int64 = 106;
optional sint64 extension_sint64 = 107;
optional uint64 extension_uint64 = 108;
optional sfixed32 extension_sfixed32 = 109;
optional fixed32 extension_fixed32 = 110;
optional float extension_float = 111;
optional sfixed64 extension_sfixed64 = 112;
optional fixed64 extension_fixed64 = 113;
optional double extension_double = 114;
optional string extension_string = 115;
optional bytes extension_bytes = 116;
optional Message extension_Message = 117;
optional Message.M extension_MessageM = 118;
optional group ExtensionGroup = 119 {
optional string extension_group = 120;
Expand All @@ -62,23 +62,23 @@ message ExtendingMessage {

// Extend with repeated fields.
extend goproto.protoc.extension.base.BaseMessage {
repeated bool repeated_x_bool = 301;
repeated Enum repeated_x_enum = 302;
repeated int32 repeated_x_int32 = 303;
repeated sint32 repeated_x_sint32 = 304;
repeated uint32 repeated_x_uint32 = 305;
repeated int64 repeated_x_int64 = 306;
repeated sint64 repeated_x_sint64 = 307;
repeated uint64 repeated_x_uint64 = 308;
repeated bool repeated_x_bool = 301;
repeated Enum repeated_x_enum = 302;
repeated int32 repeated_x_int32 = 303;
repeated sint32 repeated_x_sint32 = 304;
repeated uint32 repeated_x_uint32 = 305;
repeated int64 repeated_x_int64 = 306;
repeated sint64 repeated_x_sint64 = 307;
repeated uint64 repeated_x_uint64 = 308;
repeated sfixed32 repeated_x_sfixed32 = 309;
repeated fixed32 repeated_x_fixed32 = 310;
repeated float repeated_x_float = 311;
repeated fixed32 repeated_x_fixed32 = 310;
repeated float repeated_x_float = 311;
repeated sfixed64 repeated_x_sfixed64 = 312;
repeated fixed64 repeated_x_fixed64 = 313;
repeated double repeated_x_double = 314;
repeated string repeated_x_string = 315;
repeated bytes repeated_x_bytes = 316;
repeated Message repeated_x_Message = 317;
repeated fixed64 repeated_x_fixed64 = 313;
repeated double repeated_x_double = 314;
repeated string repeated_x_string = 315;
repeated bytes repeated_x_bytes = 316;
repeated Message repeated_x_Message = 317;
repeated group RepeatedGroup = 318 {
repeated string repeated_x_group = 319;
}
Expand Down
68 changes: 35 additions & 33 deletions cmd/protoc-gen-go/testdata/extensions/proto3/ext3.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,52 @@

syntax = "proto3";

import "google/protobuf/descriptor.proto";

package goproto.protoc.extension.proto3;

import "google/protobuf/descriptor.proto";

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/proto3";

message Message {}
enum Enum { ZERO = 0; }
enum Enum {
ZERO = 0;
}

// The only types proto3 is allowed to extend are descriptor options.
extend google.protobuf.MessageOptions {
bool extension_bool = 1001;
Enum extension_enum = 1002;
int32 extension_int32 = 1003;
sint32 extension_sint32 = 1004;
uint32 extension_uint32 = 1005;
int64 extension_int64 = 1006;
sint64 extension_sint64 = 1007;
uint64 extension_uint64 = 1008;
bool extension_bool = 1001;
Enum extension_enum = 1002;
int32 extension_int32 = 1003;
sint32 extension_sint32 = 1004;
uint32 extension_uint32 = 1005;
int64 extension_int64 = 1006;
sint64 extension_sint64 = 1007;
uint64 extension_uint64 = 1008;
sfixed32 extension_sfixed32 = 1009;
fixed32 extension_fixed32 = 1010;
float extension_float = 1011;
fixed32 extension_fixed32 = 1010;
float extension_float = 1011;
sfixed64 extension_sfixed64 = 1012;
fixed64 extension_fixed64 = 1013;
double extension_double = 1014;
string extension_string = 1015;
bytes extension_bytes = 1016;
Message extension_Message = 1017;
fixed64 extension_fixed64 = 1013;
double extension_double = 1014;
string extension_string = 1015;
bytes extension_bytes = 1016;
Message extension_Message = 1017;

repeated bool repeated_extension_bool = 2001;
repeated Enum repeated_extension_enum = 2002;
repeated int32 repeated_extension_int32 = 2003;
repeated sint32 repeated_extension_sint32 = 2004;
repeated uint32 repeated_extension_uint32 = 2005;
repeated int64 repeated_extension_int64 = 2006;
repeated sint64 repeated_extension_sint64 = 2007;
repeated uint64 repeated_extension_uint64 = 2008;
repeated bool repeated_extension_bool = 2001;
repeated Enum repeated_extension_enum = 2002;
repeated int32 repeated_extension_int32 = 2003;
repeated sint32 repeated_extension_sint32 = 2004;
repeated uint32 repeated_extension_uint32 = 2005;
repeated int64 repeated_extension_int64 = 2006;
repeated sint64 repeated_extension_sint64 = 2007;
repeated uint64 repeated_extension_uint64 = 2008;
repeated sfixed32 repeated_extension_sfixed32 = 2009;
repeated fixed32 repeated_extension_fixed32 = 2010;
repeated float repeated_extension_float = 2011;
repeated fixed32 repeated_extension_fixed32 = 2010;
repeated float repeated_extension_float = 2011;
repeated sfixed64 repeated_extension_sfixed64 = 2012;
repeated fixed64 repeated_extension_fixed64 = 2013;
repeated double repeated_extension_double = 2014;
repeated string repeated_extension_string = 2015;
repeated bytes repeated_extension_bytes = 2016;
repeated Message repeated_extension_Message = 2017;
repeated fixed64 repeated_extension_fixed64 = 2013;
repeated double repeated_extension_double = 2014;
repeated string repeated_extension_string = 2015;
repeated bytes repeated_extension_bytes = 2016;
repeated Message repeated_extension_Message = 2017;
}
4 changes: 2 additions & 2 deletions cmd/protoc-gen-go/testdata/fieldnames/fieldnames.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ message Message {
// Field names that conflict with each other after CamelCasing.
optional string CamelCase = 20;
optional string CamelCase_ = 21;
optional string camel_case = 22; // conflicts with 20, 21
optional string CamelCase__ = 23; // conflicts with 21, 21, renamed 22
optional string camel_case = 22; // conflicts with 20, 21
optional string CamelCase__ = 23; // conflicts with 21, 21, renamed 22

// Field with a getter that conflicts with another field.
optional string get_name = 30;
Expand Down
12 changes: 6 additions & 6 deletions cmd/protoc-gen-go/testdata/import_public/a.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions cmd/protoc-gen-go/testdata/import_public/a.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ syntax = "proto2";

package goproto.protoc.import_public;

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public";
// Same Go package.
import public "cmd/protoc-gen-go/testdata/import_public/b.proto";

// Different Go package.
import public "cmd/protoc-gen-go/testdata/import_public/sub/a.proto";

import public "cmd/protoc-gen-go/testdata/import_public/sub/a.proto"; // Different Go package.
import public "cmd/protoc-gen-go/testdata/import_public/b.proto"; // Same Go package.
option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public";

message Public {
optional goproto.protoc.import_public.sub.M m = 1;
Expand Down
4 changes: 2 additions & 2 deletions cmd/protoc-gen-go/testdata/import_public/b.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ syntax = "proto2";

package goproto.protoc.import_public;

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public";

import "cmd/protoc-gen-go/testdata/import_public/sub/a.proto";

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public";

message Local {
optional goproto.protoc.import_public.sub.M m = 1;
optional goproto.protoc.import_public.sub.E e = 2;
Expand Down
6 changes: 3 additions & 3 deletions cmd/protoc-gen-go/testdata/import_public/c.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ syntax = "proto2";

package goproto.protoc.import_public;

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public";

import "cmd/protoc-gen-go/testdata/import_public/a.proto";

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public";

message UsingPublicImport {
// Local is declared in b.proto, which is a public import of a.proto.
optional Local local = 1;
// Sub2Message is declared in sub2/a.proto, which is a public import of
// sub/a.proto, which is a public import of a.proto.
optional sub2.Sub2Message sub2 = 2; // declared in sub2/a.proto
optional sub2.Sub2Message sub2 = 2; // declared in sub2/a.proto
}
12 changes: 6 additions & 6 deletions cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions cmd/protoc-gen-go/testdata/import_public/sub/a.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ syntax = "proto2";

package goproto.protoc.import_public.sub;

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub";
import public "cmd/protoc-gen-go/testdata/import_public/sub2/a.proto";

import "cmd/protoc-gen-go/testdata/import_public/sub/b.proto";
import public "cmd/protoc-gen-go/testdata/import_public/sub2/a.proto";

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub";

message M {
// Field using a type in the same Go package, but a different source file.
optional M2 m2 = 1;
optional string s = 4 [default="default"];
optional bytes b = 5 [default="default"];
optional double f = 6 [default=nan];
optional string s = 4 [default = "default"];
optional bytes b = 5 [default = "default"];
optional double f = 6 [default = nan];

oneof oneof_field {
int32 oneof_int32 = 2;
Expand Down
3 changes: 1 addition & 2 deletions cmd/protoc-gen-go/testdata/import_public/sub/b.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ package goproto.protoc.import_public.sub;

option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub";

message M2 {
}
message M2 {}
Loading

0 comments on commit 2caa6b0

Please sign in to comment.